We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d39c353 commit 481b9d8Copy full SHA for 481b9d8
packages/k2-alpine/src/components/Animated/AnimatedPressable.tsx
@@ -38,17 +38,22 @@ export const AnimatedPressable = memo(
38
})
39
}
40
41
+ const throttledOnPress = throttle(
42
+ event => {
43
+ onPress?.(event)
44
+ },
45
+ 1000,
46
+ {
47
+ leading: true,
48
+ trailing: false
49
+ }
50
+ )
51
+
52
const onPressEvent = useCallback(
- (event: GestureResponderEvent) => {
- throttle(
- () => {
- onPress?.(event)
- },
- 1000,
- { leading: true, trailing: false }
- )
53
+ (event: GestureResponderEvent): void => {
54
+ throttledOnPress(event)
55
},
- [onPress]
56
+ [throttledOnPress]
57
)
58
59
const animatedStyle = useAnimatedStyle(() => {
0 commit comments