This commit is contained in:
vineyardbovines
2026-05-05 12:07:54 -04:00
parent 7de1d3eaf0
commit a5d697d802
3 changed files with 9 additions and 3 deletions
@@ -6,6 +6,7 @@ import {
type PanGesture,
} from 'react-native-gesture-handler'
import Animated, {
type AnimatableValue,
runOnJS,
type SharedValue,
useAnimatedReaction,
@@ -460,7 +461,7 @@ function clampTranslation(
return clampedValue
}
function withClampedSpring(value: any) {
function withClampedSpring<T extends AnimatableValue>(value: T): T {
'worklet'
return withSpring(value, {overshootClamping: true})
}
+5 -1
View File
@@ -13,6 +13,7 @@ import {SystemBars} from 'react-native-edge-to-edge'
import {Gesture} from 'react-native-gesture-handler'
import PagerView from 'react-native-pager-view'
import Animated, {
type AnimatableValue,
type AnimatedRef,
cancelAnimation,
interpolate,
@@ -735,7 +736,10 @@ function interpolateTransform(
}
}
function withClampedSpring(value: any, config: WithSpringConfig) {
function withClampedSpring<T extends AnimatableValue>(
value: T,
config: WithSpringConfig,
): T {
'worklet'
return withSpring(value, {...config, overshootClamping: true})
}
+2 -1
View File
@@ -6,6 +6,7 @@
*
*/
import {type Component} from 'react'
import {type TransformsStyle} from 'react-native'
import {
type AnimatedRef,
@@ -28,7 +29,7 @@ export type ImageSource = {
thumbUri: string
thumbDimensions: Dimensions | null
thumbRect: MeasuredDimensions | null
thumbRef?: AnimatedRef<any> | null
thumbRef?: AnimatedRef<Component> | null
thumbBorderRadius?: number
alt?: string
type: 'image' | 'circle-avi' | 'rect-avi'