Skip to content

Commit fbcb1af

Browse files
committed
feat: add BlankSheet example
1 parent f69b728 commit fbcb1af

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

example/src/App.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ import { Text, View, type TextStyle, type ViewStyle } from 'react-native'
33
import { TrueSheet } from '@lodev09/react-native-true-sheet'
44
import MapView from 'react-native-maps'
55

6-
import { BasicSheet, FlatListSheet, GestureSheet, PromptSheet, ScrollViewSheet } from './sheets'
6+
import {
7+
BasicSheet,
8+
BlankSheet,
9+
FlatListSheet,
10+
GestureSheet,
11+
PromptSheet,
12+
ScrollViewSheet,
13+
} from './sheets'
714
import { Button, Spacer } from './components'
815
import { BLUE, DARK, GRAY, SPACING } from './utils'
916

@@ -15,6 +22,7 @@ export default function App() {
1522
const scrollViewSheet = useRef<TrueSheet>(null)
1623
const flatListSheet = useRef<TrueSheet>(null)
1724
const gestureSheet = useRef<TrueSheet>(null)
25+
const blankSheet = useRef<TrueSheet>(null)
1826

1927
const presentBasicSheet = async (index = 0) => {
2028
await basicSheet.current?.present(index)
@@ -60,6 +68,7 @@ export default function App() {
6068
<Button text="TrueSheet ScrollView" onPress={() => scrollViewSheet.current?.present()} />
6169
<Button text="TrueSheet FlatList" onPress={() => flatListSheet.current?.present()} />
6270
<Button text="TrueSheet Gestures" onPress={() => gestureSheet.current?.present()} />
71+
<Button text="Blank Sheet" onPress={() => blankSheet.current?.present()} />
6372

6473
<Spacer />
6574
<Button text="Expand" onPress={() => sheetRef.current?.resize(2)} />
@@ -70,6 +79,7 @@ export default function App() {
7079
<ScrollViewSheet ref={scrollViewSheet} />
7180
<FlatListSheet ref={flatListSheet} />
7281
<GestureSheet ref={gestureSheet} />
82+
<BlankSheet ref={blankSheet} />
7383
</TrueSheet>
7484
</View>
7585
)

example/src/sheets/BlankSheet.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React, { forwardRef, type Ref } from 'react'
2+
import { Text, type ViewStyle } from 'react-native'
3+
import { TrueSheet, type TrueSheetProps } from '@lodev09/react-native-true-sheet'
4+
5+
import { $WHITE_TEXT, DARK, SPACING } from '../utils'
6+
7+
interface BlankSheetProps extends TrueSheetProps {}
8+
9+
export const BlankSheet = forwardRef((props: BlankSheetProps, ref: Ref<TrueSheet>) => {
10+
return (
11+
<TrueSheet
12+
ref={ref}
13+
sizes={['medium', 'large']}
14+
blurTint="dark"
15+
cornerRadius={12}
16+
backgroundColor={DARK}
17+
keyboardMode="pan"
18+
contentContainerStyle={$content}
19+
{...props}
20+
>
21+
<Text style={$WHITE_TEXT}>Blank Sheet</Text>
22+
</TrueSheet>
23+
)
24+
})
25+
26+
BlankSheet.displayName = 'BlankSheet'
27+
28+
const $content: ViewStyle = {
29+
padding: SPACING,
30+
}

example/src/sheets/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './PromptSheet'
33
export * from './ScrollViewSheet'
44
export * from './FlatListSheet'
55
export * from './GestureSheet'
6+
export * from './BlankSheet'

0 commit comments

Comments
 (0)