fix reanimated issue

This commit is contained in:
Samuel Newman
2025-04-25 12:40:53 +02:00
parent d53dc86361
commit 544565e567
+23 -6
View File
@@ -1,11 +1,16 @@
import {useCallback} from 'react' import {useCallback} from 'react'
import {LayoutChangeEvent, ScrollView, StyleSheet, View} from 'react-native' import {
type LayoutChangeEvent,
ScrollView,
StyleSheet,
View,
} from 'react-native'
import Animated, { import Animated, {
interpolate, interpolate,
runOnJS, runOnJS,
runOnUI, runOnUI,
scrollTo, scrollTo,
SharedValue, type SharedValue,
useAnimatedReaction, useAnimatedReaction,
useAnimatedRef, useAnimatedRef,
useAnimatedStyle, useAnimatedStyle,
@@ -267,15 +272,27 @@ export function TabBar({
{ {
translateX: interpolate( translateX: interpolate(
dragProgress.get(), dragProgress.get(),
layoutsValue.map((l, i) => i), layoutsValue.map((l, i) => {
layoutsValue.map(l => l.x + l.width / 2 - contentSize.get() / 2), 'worklet'
return i
}),
layoutsValue.map(l => {
'worklet'
return l.x + l.width / 2 - contentSize.get() / 2
}),
), ),
}, },
{ {
scaleX: interpolate( scaleX: interpolate(
dragProgress.get(), dragProgress.get(),
textLayoutsValue.map((l, i) => i), textLayoutsValue.map((l, i) => {
textLayoutsValue.map((l, i) => getScaleX(i)), 'worklet'
return i
}),
textLayoutsValue.map((l, i) => {
'worklet'
return getScaleX(i)
}),
), ),
}, },
], ],