Skip to content

Commit

Permalink
refactor: types
Browse files Browse the repository at this point in the history
  • Loading branch information
lodev09 committed Mar 27, 2024
1 parent fef2b20 commit 9ea6253
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
16 changes: 8 additions & 8 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from 'react-native'
import { TrueSheet } from '@lodev09/react-native-true-sheet'

// import { times } from './utils'
import { times } from './utils'

const CONTENT_PADDING = 16
const FOOTER_HEIGHT = 80
Expand All @@ -38,8 +38,8 @@ export default function App() {
const sheet2 = useRef<TrueSheet>(null)
const sheet3 = useRef<TrueSheet>(null)

const _scrollViewRef = useRef<ScrollView>(null)
const _flatListRef = useRef<FlatList>(null)
const scrollViewRef = useRef<ScrollView>(null)
const flatListRef = useRef<FlatList>(null)

const presentSheet1 = (index = 0) => {
sheet1.current?.present(index)
Expand Down Expand Up @@ -67,20 +67,20 @@ export default function App() {
>
<DemoContent color={DARK_GRAY} />
<DemoContent color={DARK_GRAY} />
{/* <Button text="Present Large" onPress={() => presentSheet1(2)} />
<Button text="Present Large" onPress={() => presentSheet1(2)} />
<Button text="Present 80%" onPress={() => presentSheet1(1)} />
<Button text="Present Auto" onPress={() => presentSheet1(0)} /> */}
<Button text="Present Auto" onPress={() => presentSheet1(0)} />
<Button text="Dismis" onPress={dismissSheet1} />
</TrueSheet>

{/* <TrueSheet
<TrueSheet
ref={sheet2}
scrollRef={scrollViewRef}
onDismiss={() => console.log('Sheet 2 dismissed!')}
onPresent={() => console.log(`Sheet 2 presented!`)}
FooterComponent={Footer}
>
<ScrollView ref={scrollViewRef} contentContainerStyle={$content} indicatorStyle="black">
<ScrollView contentContainerStyle={$content} indicatorStyle="black">
{times(25, (i) => (
<DemoContent key={i} text={String(i + 1)} />
))}
Expand All @@ -101,7 +101,7 @@ export default function App() {
indicatorStyle="black"
renderItem={({ item }) => <DemoContent text={String(item + 1)} />}
/>
</TrueSheet> */}
</TrueSheet>
</View>
)
}
Expand Down
2 changes: 1 addition & 1 deletion ios/TrueSheetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {

@objc
func setSizes(_ sizes: [Any]) {
self.sizes = sizes
self.sizes = Array(sizes.prefix(3))
configureSheetIfPresented()
}

Expand Down
5 changes: 3 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ export interface TrueSheetProps extends ViewProps {

/**
* The sizes you want the Sheet to support.
* IMPORTANT! Sort them in ascending order
* ⚠️ Maximum of 3 sizes only!
* As in: [collapsed, half-expanded, expanded]
*
* Example:
* ```ts
* size={['auto', 400, '80%', 'large']}
* size={['auto', '60%', 'large']}
* ```
*
* @default ['medium', 'large']
Expand Down

0 comments on commit 9ea6253

Please sign in to comment.