From faa389e060209dacaf82cd827fecd4612de34f76 Mon Sep 17 00:00:00 2001 From: Maxym Hyba <75982180+M21H@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:46:21 +0200 Subject: [PATCH] rm clamp (#9271) --- src/screens/VideoFeed/components/Scrubber.tsx | 6 +----- src/view/com/util/MainScrollProvider.tsx | 12 ++++++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/screens/VideoFeed/components/Scrubber.tsx b/src/screens/VideoFeed/components/Scrubber.tsx index bd8ca27787..85bd4fddfd 100644 --- a/src/screens/VideoFeed/components/Scrubber.tsx +++ b/src/screens/VideoFeed/components/Scrubber.tsx @@ -6,6 +6,7 @@ import { type NativeGesture, } from 'react-native-gesture-handler' import Animated, { + clamp, interpolate, runOnJS, runOnUI, @@ -258,8 +259,3 @@ function PlayerListener({ return null } - -function clamp(num: number, min: number, max: number) { - 'worklet' - return Math.min(Math.max(num, min), max) -} diff --git a/src/view/com/util/MainScrollProvider.tsx b/src/view/com/util/MainScrollProvider.tsx index d8596b6f3f..e3f45c11c7 100644 --- a/src/view/com/util/MainScrollProvider.tsx +++ b/src/view/com/util/MainScrollProvider.tsx @@ -1,6 +1,11 @@ import React, {useCallback, useEffect} from 'react' import {type NativeScrollEvent} from 'react-native' -import {interpolate, useSharedValue, withSpring} from 'react-native-reanimated' +import { + clamp, + interpolate, + useSharedValue, + withSpring, +} from 'react-native-reanimated' import EventEmitter from 'eventemitter3' import {ScrollProvider} from '#/lib/ScrollContext' @@ -10,11 +15,6 @@ import {useShellLayout} from '#/state/shell/shell-layout' const WEB_HIDE_SHELL_THRESHOLD = 200 -function clamp(num: number, min: number, max: number) { - 'worklet' - return Math.min(Math.max(num, min), max) -} - export function MainScrollProvider({children}: {children: React.ReactNode}) { const {headerHeight} = useShellLayout() const {headerMode} = useMinimalShellMode()