clear last tickets
This commit is contained in:
+19
-32
@@ -29,37 +29,30 @@ export default ({
|
||||
const SLIDER_WIDTH = layout?.width;
|
||||
const MAX_VALUE = SLIDER_WIDTH - INITIAL_BOX_SIZE;
|
||||
|
||||
const handleSeekStart = () => {
|
||||
if (seekEnabled && typeof onSeekStart === "function" && !seekingRef.current) {
|
||||
seekingRef.current = true;
|
||||
onSeekStart();
|
||||
}
|
||||
};
|
||||
|
||||
const handleSeekEnd = () => {
|
||||
if (seekingRef.current && typeof onSeekEnd === "function") {
|
||||
seekingRef.current = false;
|
||||
onSeekEnd();
|
||||
}
|
||||
};
|
||||
|
||||
const pan = Gesture.Pan()
|
||||
.enabled(seekEnabled)
|
||||
.onBegin(() => {
|
||||
if (
|
||||
seekEnabled &&
|
||||
typeof onSeekStart === "function" &&
|
||||
!seekingRef.current
|
||||
) {
|
||||
seekingRef.current = true;
|
||||
runOnJS(onSeekStart)();
|
||||
}
|
||||
runOnJS(handleSeekStart)();
|
||||
})
|
||||
.onStart(() => {
|
||||
if (
|
||||
seekEnabled &&
|
||||
typeof onSeekStart === "function" &&
|
||||
!seekingRef.current
|
||||
) {
|
||||
seekingRef.current = true;
|
||||
runOnJS(onSeekStart)();
|
||||
}
|
||||
runOnJS(handleSeekStart)();
|
||||
})
|
||||
.onChange((event) => {
|
||||
if (
|
||||
seekEnabled &&
|
||||
typeof onSeekStart === "function" &&
|
||||
!seekingRef.current
|
||||
) {
|
||||
seekingRef.current = true;
|
||||
runOnJS(onSeekStart)();
|
||||
}
|
||||
runOnJS(handleSeekStart)();
|
||||
offset.value =
|
||||
Math.abs(offset.value) <= MAX_VALUE
|
||||
? offset.value + event.changeX <= 0
|
||||
@@ -81,16 +74,10 @@ export default ({
|
||||
// Reanimated -> JS thread bridge
|
||||
runOnJS(onSeek)(ratio);
|
||||
}
|
||||
if (seekingRef.current && typeof onSeekEnd === "function") {
|
||||
seekingRef.current = false;
|
||||
runOnJS(onSeekEnd)();
|
||||
}
|
||||
runOnJS(handleSeekEnd)();
|
||||
})
|
||||
.onFinalize(() => {
|
||||
if (seekingRef.current && typeof onSeekEnd === "function") {
|
||||
seekingRef.current = false;
|
||||
runOnJS(onSeekEnd)();
|
||||
}
|
||||
runOnJS(handleSeekEnd)();
|
||||
});
|
||||
|
||||
// Reflect external progress into the slider UI
|
||||
|
||||
Reference in New Issue
Block a user