react-native-boxes 1.4.13 → 1.4.15

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 +28 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-boxes",
3
- "version": "1.4.13",
3
+ "version": "1.4.15",
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
@@ -54,6 +54,26 @@ export const BottomSheet = (props: BottomSheetProps) => {
54
54
  .onEnd(() => {
55
55
  props.onDismiss && props.onDismiss()
56
56
  })
57
+
58
+ const Wrapper = props.swipeToCloseDisabled ? ({ children }: any) => {
59
+ return (
60
+ <View style={[styles.modalContainer, {
61
+ backgroundColor: props.backgroundColor || theme.colors.forground
62
+ }]}>
63
+ {children}
64
+ </View>
65
+ )
66
+ } : ({ children }: any) => {
67
+ return (
68
+ <View style={[styles.modalContainer, {
69
+ backgroundColor: props.backgroundColor || theme.colors.forground
70
+ }]}>
71
+ <GestureDetector gesture={fling}>
72
+ {children}
73
+ </GestureDetector>
74
+ </View>
75
+ )
76
+ }
57
77
  return (
58
78
  <View style={styles.container}>
59
79
  <Modal
@@ -92,9 +112,7 @@ export const BottomSheet = (props: BottomSheetProps) => {
92
112
  visible={modalVisible}
93
113
  onRequestClose={() => cancel()}
94
114
  >
95
- <View style={[styles.modalContainer, {
96
- backgroundColor: props.backgroundColor || theme.colors.forground
97
- }]}>
115
+ <Wrapper>
98
116
  <View style={[{
99
117
  paddingTop: theme.dimens.space.md,
100
118
  paddingStart: theme.dimens.space.lg,
@@ -104,6 +122,7 @@ export const BottomSheet = (props: BottomSheetProps) => {
104
122
  justifyContent: 'space-between',
105
123
  width: '100%'
106
124
  }}>
125
+
107
126
  <View style={{ width: theme.dimens.icon.md }} />
108
127
  {
109
128
  typeof props.title == 'string' ? (
@@ -141,20 +160,18 @@ export const BottomSheet = (props: BottomSheetProps) => {
141
160
  {props.children}
142
161
  </ScrollView>
143
162
  ) : (
144
- <GestureDetector gesture={fling}>
145
- <VBox style={{
146
- width: '100%'
147
- }}>
148
- {props.children}
149
- </VBox>
150
- </GestureDetector>
163
+ <VBox style={{
164
+ width: '100%'
165
+ }}>
166
+ {props.children}
167
+ </VBox>
151
168
  )
152
169
  }
153
170
 
154
171
 
155
172
  </VBox>
156
173
  </View>
157
- </View>
174
+ </Wrapper>
158
175
  </Modal>
159
176
  </View>
160
177
  );