Skip to content

Commit 14e8b0e

Browse files
committed
feat: props.useNativeDriver
1 parent ad43e58 commit 14e8b0e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

LightboxOverlay.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const LightboxOverlay = (props) => {
8282
setIsPanning(true);
8383
},
8484
onPanResponderMove: Animated.event([null, { dy: pan.current }], {
85-
useNativeDriver: false,
85+
useNativeDriver: props.useNativeDriver,
8686
}),
8787
onPanResponderTerminationRequest: (evt, gestureState) => true,
8888
onPanResponderRelease: (evt, gestureState) => {
@@ -99,12 +99,12 @@ const LightboxOverlay = (props) => {
9999
Animated.spring(pan.current, {
100100
toValue: 0,
101101
...props.springConfig,
102-
useNativeDriver: false,
102+
useNativeDriver: props.useNativeDriver,
103103
}).start(() => setIsPanning(false));
104104
}
105105
},
106106
});
107-
}, []);
107+
}, [props.useNativeDriver]);
108108

109109
useEffect(() => {
110110
if (props.isOpen) {
@@ -129,7 +129,7 @@ const LightboxOverlay = (props) => {
129129
Animated.spring(openVal.current, {
130130
toValue: 1,
131131
...props.springConfig,
132-
useNativeDriver: false,
132+
useNativeDriver: props.useNativeDriver,
133133
}).start(() => {
134134
setIsAnimating(false);
135135
props.didOpen();
@@ -146,7 +146,7 @@ const LightboxOverlay = (props) => {
146146
Animated.spring(openVal.current, {
147147
toValue: 0,
148148
...props.springConfig,
149-
useNativeDriver: false,
149+
useNativeDriver: props.useNativeDriver,
150150
}).start(() => {
151151
setIsAnimating(false);
152152
});
@@ -270,11 +270,13 @@ LightboxOverlay.propTypes = {
270270
onClose: PropTypes.func,
271271
willClose: PropTypes.func,
272272
swipeToDismiss: PropTypes.bool,
273+
useNativeDriver: PropTypes.bool
273274
};
274275

275276
LightboxOverlay.defaultProps = {
276277
springConfig: { tension: 30, friction: 7 },
277278
backgroundColor: "black",
279+
useNativeDriver: false
278280
};
279281

280282
export default LightboxOverlay;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-lightbox-v2",
3-
"version": "0.8.7",
3+
"version": "0.8.8",
44
"description": "Images etc in Full Screen Lightbox Popovers for React Native",
55
"main": "Lightbox.js",
66
"scripts": {

0 commit comments

Comments
 (0)