Skip to content

Commit 10327d9

Browse files
authored
Incubator.Slider - fix onSeek functions (#2955)
* Incubator.Slider - fix onSeek functions * revert screen change
1 parent 892eb99 commit 10327d9

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/incubator/Slider/index.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,20 @@ const Slider = React.memo((props: Props) => {
345345
}
346346
}, []);
347347

348+
const _onSeekStart = () => {
349+
'worklet';
350+
if (onSeekStart) {
351+
runOnJS(onSeekStart)();
352+
}
353+
};
354+
355+
const _onSeekEnd = () => {
356+
'worklet';
357+
if (onSeekEnd) {
358+
runOnJS(onSeekEnd)();
359+
}
360+
};
361+
348362
// @ts-expect-error should be fixed in version 3.5 (https://github.com/software-mansion/react-native-reanimated/pull/4881)
349363
const trackAnimatedStyles = useAnimatedStyle(() => {
350364
if (useRange) {
@@ -360,7 +374,6 @@ const Slider = React.memo((props: Props) => {
360374
});
361375

362376
/** renders */
363-
364377
const renderThumb = (type: ThumbType) => {
365378
return (
366379
<Thumb
@@ -369,8 +382,8 @@ const Slider = React.memo((props: Props) => {
369382
offset={type === ThumbType.DEFAULT ? defaultThumbOffset : rangeThumbOffset}
370383
gap={rangeGap}
371384
secondary={type !== ThumbType.DEFAULT}
372-
onSeekStart={onSeekStart}
373-
onSeekEnd={onSeekEnd}
385+
onSeekStart={_onSeekStart}
386+
onSeekEnd={_onSeekEnd}
374387
shouldDisableRTL={shouldDisableRTL}
375388
disabled={disabled}
376389
disableActiveStyling={disableActiveStyling}

0 commit comments

Comments
 (0)