react-native-snap-sheet 1.0.7 → 1.0.9

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/index.ts CHANGED
@@ -181,6 +181,11 @@ export interface SnapSheetModalProps extends SnapSheetBaseProps {
181
181
  */
182
182
  renderBackDrop?: React.ReactNode | (() => React.ReactNode);
183
183
 
184
+ /**
185
+ * Optional set color for backdrop
186
+ */
187
+ backdropColor?: string | undefined;
188
+
184
189
  /**
185
190
  * Disable backdrop press
186
191
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-snap-sheet",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/deflexable/react-native-snap-sheet#readme",
6
6
  "bugs": {
@@ -19,7 +19,7 @@
19
19
  "test": "echo \"Error: no test specified\" && exit 1"
20
20
  },
21
21
  "dependencies": {
22
- "react-native-dodge-keyboard": "^1.0.7",
22
+ "react-native-dodge-keyboard": "^1.0.8",
23
23
  "react-native-push-back": "^1.0.0"
24
24
  }
25
25
  }
package/src/snapsheet.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState, cloneElement } from "react";
2
2
  import { Animated, PanResponder, StyleSheet, useAnimatedValue, View } from "react-native";
3
- import DodgeKeyboard, { createHijackedElement, ReactHijacker, __HijackNode } from "react-native-dodge-keyboard";
3
+ import { DodgeKeyboard, createHijackedElement, ReactHijacker, __HijackNode } from "react-native-dodge-keyboard";
4
4
  import { doRendable, isNumber, isPositiveNumber } from "./utils";
5
5
  import { styling } from "./styling";
6
6
 
@@ -165,7 +165,7 @@ const SnapSheet = forwardRef(function SnapSheet({
165
165
  stillSnapping.current = false;
166
166
  if (shouldRefreshDodge.current) {
167
167
  isLifting.current = false;
168
- dodgeRef.current.trigger();
168
+ if (dodgeRef.current) dodgeRef.current.trigger();
169
169
  }
170
170
  }, { timeout: 700 });
171
171
  }
@@ -20,6 +20,7 @@ export const SnapSheetModalBase = forwardRef(function SnapSheetModalBase({
20
20
  centered,
21
21
  onStateChanged,
22
22
  renderBackDrop,
23
+ backdropColor,
23
24
  disableBackdrop,
24
25
  fillScreen = true,
25
26
  unMountChildrenWhenClosed = true,
@@ -192,6 +193,11 @@ export const SnapSheetModalBase = forwardRef(function SnapSheetModalBase({
192
193
  top: 0
193
194
  }) : undefined, [centered, contentHeight, viewWidth]);
194
195
 
196
+ const backdropStyle = useMemo(() => ({
197
+ ...styling.backdropStyle,
198
+ ...backdropColor ? { backgroundColor: backdropColor } : undefined
199
+ }), [backdropColor]);
200
+
195
201
  const inputIdIterator = useRef(0);
196
202
 
197
203
  const renderChild = () =>
@@ -205,7 +211,7 @@ export const SnapSheetModalBase = forwardRef(function SnapSheetModalBase({
205
211
  doRendable(
206
212
  renderBackDrop,
207
213
  <Pressable
208
- style={styling.backdropStyle}
214
+ style={backdropStyle}
209
215
  disabled={!!disableBackdrop}
210
216
  onPress={() => {
211
217
  snapModal.current(0);