fix: SlideToConfirm use useNativeDriver:false so setValue follows finger in real-time
This commit is contained in:
@@ -38,12 +38,12 @@ export function SlideToConfirm({ label = 'Slide to confirm', color = '#059669',
|
|||||||
const onTouchEnd = () => {
|
const onTouchEnd = () => {
|
||||||
if (disabled || done) return;
|
if (disabled || done) return;
|
||||||
if (maxX > 0 && currentX.current / maxX >= THRESHOLD) {
|
if (maxX > 0 && currentX.current / maxX >= THRESHOLD) {
|
||||||
Animated.timing(translateX, { toValue: maxX, duration: 100, useNativeDriver: true }).start(() => {
|
Animated.timing(translateX, { toValue: maxX, duration: 100, useNativeDriver: false }).start(() => {
|
||||||
setDone(true);
|
setDone(true);
|
||||||
onConfirm();
|
onConfirm();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Animated.spring(translateX, { toValue: 0, useNativeDriver: true, speed: 25, bounciness: 4 }).start();
|
Animated.spring(translateX, { toValue: 0, useNativeDriver: false, speed: 25, bounciness: 4 }).start();
|
||||||
currentX.current = 0;
|
currentX.current = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user