Skip to content

Commit 3b6c84d

Browse files
committed
chore(example): fix types
1 parent 2b4aa88 commit 3b6c84d

File tree

4 files changed

+50
-45
lines changed

4 files changed

+50
-45
lines changed

example/src/components/sheets/BasicSheet.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { forwardRef, useRef, type Ref, useImperativeHandle } from 'react'
2-
import { type ViewStyle } from 'react-native'
2+
import { StyleSheet } from 'react-native'
33
import { TrueSheet, type TrueSheetProps } from '@lodev09/react-native-true-sheet'
44

55
import { DARK, DARK_BLUE, GRABBER_COLOR, SPACING } from '../../utils'
@@ -44,7 +44,7 @@ export const BasicSheet = forwardRef((props: BasicSheetProps, ref: Ref<TrueSheet
4444
<TrueSheet
4545
sizes={['auto', '80%', 'large']}
4646
ref={sheetRef}
47-
contentContainerStyle={$content}
47+
contentContainerStyle={styles.content}
4848
blurTint="dark"
4949
backgroundColor={DARK}
5050
cornerRadius={12}
@@ -92,7 +92,7 @@ export const BasicSheet = forwardRef((props: BasicSheetProps, ref: Ref<TrueSheet
9292
ref={childSheet}
9393
sizes={['auto']}
9494
backgroundColor={DARK}
95-
contentContainerStyle={$content}
95+
contentContainerStyle={styles.content}
9696
FooterComponent={<Footer />}
9797
>
9898
<DemoContent color={DARK_BLUE} />
@@ -104,8 +104,10 @@ export const BasicSheet = forwardRef((props: BasicSheetProps, ref: Ref<TrueSheet
104104
)
105105
})
106106

107-
const $content: ViewStyle = {
108-
padding: SPACING,
109-
}
107+
const styles = StyleSheet.create({
108+
content: {
109+
padding: SPACING,
110+
},
111+
})
110112

111113
BasicSheet.displayName = 'BasicSheet'

example/src/components/sheets/BlankSheet.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { forwardRef, type Ref } from 'react'
2-
import { Text, type ViewStyle } from 'react-native'
2+
import { StyleSheet, Text } from 'react-native'
33
import { TrueSheet, type TrueSheetProps } from '@lodev09/react-native-true-sheet'
44

55
import { $WHITE_TEXT, DARK, SPACING } from '../../utils'
@@ -16,16 +16,18 @@ export const BlankSheet = forwardRef((props: BlankSheetProps, ref: Ref<TrueSheet
1616
edgeToEdge
1717
backgroundColor={DARK}
1818
keyboardMode="pan"
19-
contentContainerStyle={$content}
19+
contentContainerStyle={styles.content}
2020
{...props}
2121
>
2222
<Text style={$WHITE_TEXT}>Blank Sheet</Text>
2323
</TrueSheet>
2424
)
2525
})
2626

27-
const $content: ViewStyle = {
28-
padding: SPACING,
29-
}
27+
const styles = StyleSheet.create({
28+
content: {
29+
padding: SPACING,
30+
},
31+
})
3032

3133
BlankSheet.displayName = 'BlankSheet'

example/src/components/sheets/GestureSheet.tsx

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { forwardRef, useRef, type Ref, useImperativeHandle } from 'react'
2-
import { useWindowDimensions, type ViewStyle } from 'react-native'
2+
import { StyleSheet, useWindowDimensions, type ViewStyle } from 'react-native'
33
import { TrueSheet, type TrueSheetProps } from '@lodev09/react-native-true-sheet'
44
import Animated, { useAnimatedStyle, useSharedValue, withDecay } from 'react-native-reanimated'
55
import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler'
@@ -49,7 +49,7 @@ export const GestureSheet = forwardRef((props: GestureSheetProps, ref: Ref<TrueS
4949
<TrueSheet
5050
sizes={['auto']}
5151
ref={sheetRef}
52-
contentContainerStyle={$content}
52+
contentContainerStyle={styles.content}
5353
blurTint="dark"
5454
edgeToEdge
5555
backgroundColor={DARK}
@@ -67,11 +67,11 @@ export const GestureSheet = forwardRef((props: GestureSheetProps, ref: Ref<TrueS
6767
FooterComponent={<Footer />}
6868
{...props}
6969
>
70-
<GestureHandlerRootView style={$gestureRoot}>
70+
<GestureHandlerRootView style={styles.gestureRoot}>
7171
<GestureDetector gesture={pan}>
72-
<Animated.View style={[$panContainer, $animatedContainer]}>
72+
<Animated.View style={[styles.panContainer, $animatedContainer]}>
7373
{times(BOXES_COUNT, (i) => (
74-
<DemoContent key={i} text={String(i + 1)} style={$box} />
74+
<DemoContent key={i} text={String(i + 1)} style={styles.box} />
7575
))}
7676
</Animated.View>
7777
</GestureDetector>
@@ -81,28 +81,27 @@ export const GestureSheet = forwardRef((props: GestureSheetProps, ref: Ref<TrueS
8181
)
8282
})
8383

84-
const $gestureRoot: ViewStyle = {
85-
flexGrow: 1,
86-
}
87-
88-
const $box: ViewStyle = {
89-
alignItems: 'center',
90-
backgroundColor: DARK_GRAY,
91-
height: BOX_SIZE,
92-
justifyContent: 'center',
93-
width: BOX_SIZE,
94-
}
95-
96-
const $content: ViewStyle = {
97-
padding: SPACING,
98-
}
99-
100-
const $panContainer: ViewStyle = {
101-
flexDirection: 'row',
102-
gap: BOX_GAP,
103-
height: CONTAINER_HEIGHT,
104-
marginBottom: SPACING,
105-
paddingVertical: SPACING,
106-
}
84+
const styles = StyleSheet.create({
85+
gestureRoot: {
86+
flexGrow: 1,
87+
},
88+
box: {
89+
alignItems: 'center',
90+
backgroundColor: DARK_GRAY,
91+
height: BOX_SIZE,
92+
justifyContent: 'center',
93+
width: BOX_SIZE,
94+
},
95+
content: {
96+
padding: SPACING,
97+
},
98+
panContainer: {
99+
flexDirection: 'row',
100+
gap: BOX_GAP,
101+
height: CONTAINER_HEIGHT,
102+
marginBottom: SPACING,
103+
paddingVertical: SPACING,
104+
},
105+
})
107106

108107
GestureSheet.displayName = 'GestureSheet'

example/src/components/sheets/PromptSheet.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { forwardRef, useRef, type Ref, useImperativeHandle, useState } from 'react'
2-
import type { ViewStyle } from 'react-native'
2+
import { StyleSheet } from 'react-native'
33
import { TrueSheet, type TrueSheetProps } from '@lodev09/react-native-true-sheet'
44

55
import { DARK, DARK_BLUE, GRABBER_COLOR, SPACING } from '../../utils'
@@ -39,7 +39,7 @@ export const PromptSheet = forwardRef((props: PromptSheetProps, ref: Ref<TrueShe
3939
edgeToEdge
4040
name="prompt-sheet"
4141
sizes={['auto', 'large']}
42-
contentContainerStyle={$content}
42+
contentContainerStyle={styles.content}
4343
blurTint="dark"
4444
backgroundColor={DARK}
4545
cornerRadius={12}
@@ -65,8 +65,10 @@ export const PromptSheet = forwardRef((props: PromptSheetProps, ref: Ref<TrueShe
6565
)
6666
})
6767

68-
PromptSheet.displayName = 'PromptSheet'
68+
const styles = StyleSheet.create({
69+
content: {
70+
padding: SPACING,
71+
},
72+
})
6973

70-
const $content: ViewStyle = {
71-
padding: SPACING,
72-
}
74+
PromptSheet.displayName = 'PromptSheet'

0 commit comments

Comments
 (0)