Skip to content

Commit c124a6f

Browse files
Merge pull request #51 from baconcheese113/master
Upgrade to 0.62.2
2 parents 5c52718 + 825e1c7 commit c124a6f

32 files changed

+17027
-8541
lines changed

Draggable.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,17 @@ export default function Draggable(props) {
7272
}, [x, y]);
7373

7474
const shouldStartDrag = React.useCallback(
75-
gs => {
75+
(gs) => {
7676
return !disabled && (Math.abs(gs.dx) > 2 || Math.abs(gs.dy) > 2);
7777
},
7878
[disabled],
7979
);
8080

8181
const reversePosition = React.useCallback(() => {
82-
Animated.spring(pan.current, {toValue: {x: 0, y: 0}}).start();
82+
Animated.spring(pan.current, {
83+
toValue: {x: 0, y: 0},
84+
useNativeDriver: false,
85+
}).start();
8386
}, [pan]);
8487

8588
const onPanResponderRelease = React.useCallback(
@@ -138,7 +141,10 @@ export default function Draggable(props) {
138141
onMoveShouldSetPanResponderCapture: (_, gestureState) =>
139142
shouldStartDrag(gestureState),
140143
onPanResponderGrant,
141-
onPanResponderMove: Animated.event([], {listener: handleOnDrag}),
144+
onPanResponderMove: Animated.event([], {
145+
listener: handleOnDrag,
146+
useNativeDriver: false,
147+
}),
142148
onPanResponderRelease,
143149
});
144150
}, [
@@ -152,7 +158,7 @@ export default function Draggable(props) {
152158
React.useEffect(() => {
153159
const curPan = pan.current; // Using an instance to avoid losing the pointer before the cleanup
154160
if (!shouldReverse) {
155-
curPan.addListener(c => (offsetFromStart.current = c));
161+
curPan.addListener((c) => (offsetFromStart.current = c));
156162
}
157163
return () => {
158164
curPan.removeAllListeners();
@@ -175,7 +181,7 @@ export default function Draggable(props) {
175181
top: y,
176182
left: x,
177183
elevation: z,
178-
z,
184+
zIndex: z,
179185
};
180186
if (renderColor) {
181187
style.backgroundColor = renderColor;
@@ -213,13 +219,13 @@ export default function Draggable(props) {
213219
}
214220
}, [children, imageSource, renderSize, renderText]);
215221

216-
const handleOnLayout = React.useCallback(event => {
222+
const handleOnLayout = React.useCallback((event) => {
217223
const {height, width} = event.nativeEvent.layout;
218224
childSize.current = {x: width, y: height};
219225
}, []);
220226

221227
const handlePressOut = React.useCallback(
222-
event => {
228+
(event) => {
223229
onPressOut(event);
224230
if (!isDragging.current) {
225231
onRelease(event, false);

0 commit comments

Comments
 (0)