react-native-boxes 1.4.9 → 1.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Modal.tsx +25 -12
package/package.json
CHANGED
package/src/Modal.tsx
CHANGED
|
@@ -21,8 +21,14 @@ export type BottomSheetProps = {
|
|
|
21
21
|
onDismiss?: Function
|
|
22
22
|
backgroundColor?: string
|
|
23
23
|
closeIcon?: string | React.ReactNode
|
|
24
|
+
swipeToCloseDisabled?: boolean
|
|
24
25
|
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* set swipeToCloseDisabled = true if you face issues with scrolling
|
|
29
|
+
* @param props
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
26
32
|
export const BottomSheet = (props: BottomSheetProps) => {
|
|
27
33
|
const [modalVisible, setModalVisible] = useState(false);
|
|
28
34
|
const theme = useContext(ThemeContext)
|
|
@@ -44,7 +50,7 @@ export const BottomSheet = (props: BottomSheetProps) => {
|
|
|
44
50
|
return (<Icon color={theme.colors.caption} name="close" />)
|
|
45
51
|
})
|
|
46
52
|
const fling = Gesture.Fling()
|
|
47
|
-
.direction(Directions.
|
|
53
|
+
.direction(Directions.DOWN)
|
|
48
54
|
.onEnd(() => {
|
|
49
55
|
props.onDismiss && props.onDismiss()
|
|
50
56
|
})
|
|
@@ -123,17 +129,24 @@ export const BottomSheet = (props: BottomSheetProps) => {
|
|
|
123
129
|
<VBox style={{
|
|
124
130
|
width: '100%'
|
|
125
131
|
}}>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
{
|
|
133
|
+
props.swipeToCloseDisabled ? (
|
|
134
|
+
<ScrollView
|
|
135
|
+
nestedScrollEnabled={true}
|
|
136
|
+
showsVerticalScrollIndicator={false}
|
|
137
|
+
style={{
|
|
138
|
+
flex: 1,
|
|
139
|
+
maxHeight: 500,
|
|
140
|
+
}}>
|
|
141
|
+
{props.children}
|
|
142
|
+
</ScrollView>
|
|
143
|
+
) : (
|
|
144
|
+
<GestureDetector gesture={fling}>
|
|
145
|
+
{props.children}
|
|
146
|
+
</GestureDetector>
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
137
150
|
|
|
138
151
|
</VBox>
|
|
139
152
|
</View>
|