Skip to content

Commit

Permalink
feat: add BlankSheet example
Browse files Browse the repository at this point in the history
  • Loading branch information
lodev09 committed Jul 21, 2024
1 parent f69b728 commit fbcb1af
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
12 changes: 11 additions & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ import { Text, View, type TextStyle, type ViewStyle } from 'react-native'
import { TrueSheet } from '@lodev09/react-native-true-sheet'
import MapView from 'react-native-maps'

import { BasicSheet, FlatListSheet, GestureSheet, PromptSheet, ScrollViewSheet } from './sheets'
import {
BasicSheet,
BlankSheet,
FlatListSheet,
GestureSheet,
PromptSheet,
ScrollViewSheet,
} from './sheets'
import { Button, Spacer } from './components'
import { BLUE, DARK, GRAY, SPACING } from './utils'

Expand All @@ -15,6 +22,7 @@ export default function App() {
const scrollViewSheet = useRef<TrueSheet>(null)
const flatListSheet = useRef<TrueSheet>(null)
const gestureSheet = useRef<TrueSheet>(null)
const blankSheet = useRef<TrueSheet>(null)

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

<Spacer />
<Button text="Expand" onPress={() => sheetRef.current?.resize(2)} />
Expand All @@ -70,6 +79,7 @@ export default function App() {
<ScrollViewSheet ref={scrollViewSheet} />
<FlatListSheet ref={flatListSheet} />
<GestureSheet ref={gestureSheet} />
<BlankSheet ref={blankSheet} />
</TrueSheet>
</View>
)
Expand Down
30 changes: 30 additions & 0 deletions example/src/sheets/BlankSheet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { forwardRef, type Ref } from 'react'
import { Text, type ViewStyle } from 'react-native'
import { TrueSheet, type TrueSheetProps } from '@lodev09/react-native-true-sheet'

import { $WHITE_TEXT, DARK, SPACING } from '../utils'

interface BlankSheetProps extends TrueSheetProps {}

export const BlankSheet = forwardRef((props: BlankSheetProps, ref: Ref<TrueSheet>) => {
return (
<TrueSheet
ref={ref}
sizes={['medium', 'large']}
blurTint="dark"
cornerRadius={12}
backgroundColor={DARK}
keyboardMode="pan"
contentContainerStyle={$content}
{...props}
>
<Text style={$WHITE_TEXT}>Blank Sheet</Text>
</TrueSheet>
)
})

BlankSheet.displayName = 'BlankSheet'

const $content: ViewStyle = {
padding: SPACING,
}
1 change: 1 addition & 0 deletions example/src/sheets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './PromptSheet'
export * from './ScrollViewSheet'
export * from './FlatListSheet'
export * from './GestureSheet'
export * from './BlankSheet'

0 comments on commit fbcb1af

Please sign in to comment.