react-native-boxes 1.4.9 → 1.4.10
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 +20 -12
package/package.json
CHANGED
package/src/Modal.tsx
CHANGED
|
@@ -21,6 +21,7 @@ export type BottomSheetProps = {
|
|
|
21
21
|
onDismiss?: Function
|
|
22
22
|
backgroundColor?: string
|
|
23
23
|
closeIcon?: string | React.ReactNode
|
|
24
|
+
swipeToCloseDisabled?: boolean
|
|
24
25
|
|
|
25
26
|
}
|
|
26
27
|
export const BottomSheet = (props: BottomSheetProps) => {
|
|
@@ -44,7 +45,7 @@ export const BottomSheet = (props: BottomSheetProps) => {
|
|
|
44
45
|
return (<Icon color={theme.colors.caption} name="close" />)
|
|
45
46
|
})
|
|
46
47
|
const fling = Gesture.Fling()
|
|
47
|
-
.direction(Directions.
|
|
48
|
+
.direction(Directions.DOWN)
|
|
48
49
|
.onEnd(() => {
|
|
49
50
|
props.onDismiss && props.onDismiss()
|
|
50
51
|
})
|
|
@@ -123,17 +124,24 @@ export const BottomSheet = (props: BottomSheetProps) => {
|
|
|
123
124
|
<VBox style={{
|
|
124
125
|
width: '100%'
|
|
125
126
|
}}>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
127
|
+
{
|
|
128
|
+
props.swipeToCloseDisabled ? (
|
|
129
|
+
<ScrollView
|
|
130
|
+
nestedScrollEnabled={true}
|
|
131
|
+
showsVerticalScrollIndicator={false}
|
|
132
|
+
style={{
|
|
133
|
+
flex: 1,
|
|
134
|
+
maxHeight: 500,
|
|
135
|
+
}}>
|
|
136
|
+
{props.children}
|
|
137
|
+
</ScrollView>
|
|
138
|
+
) : (
|
|
139
|
+
<GestureDetector gesture={fling}>
|
|
140
|
+
{props.children}
|
|
141
|
+
</GestureDetector>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
137
145
|
|
|
138
146
|
</VBox>
|
|
139
147
|
</View>
|