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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Modal.tsx +25 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-boxes",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "description": "A react native library for rapid development of UI using boxes",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
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.UP | Directions.DOWN)
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
- <GestureDetector gesture={fling}>
127
- <ScrollView
128
- nestedScrollEnabled={true}
129
- showsVerticalScrollIndicator={false}
130
- style={{
131
- flex: 1,
132
- maxHeight: 500,
133
- }}>
134
- {props.children}
135
- </ScrollView>
136
- </GestureDetector>
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>