Ami*_*ine 4 animation transform react-native react-native-android
我正在尝试在 React Native 中制作翻译动画。
这是我的代码
const scrollX = React.useRef(new Animated.Value(0)).current;
<Animated.ScrollView
horizontal
snapToInterval={width}
onScroll={Animated.event(
[{ nativeEvent: { contentOffset: { x: scrollX } } }],
{ useNativeDriver: false }
)}
scrollEventThrottle={16}
></Animated.ScrollView>
<Animated.View style={{ transform: [{ translateX: multiply(scrollX, -1) }] }}>
<Text>Some text</Text>
</Animated.View>
Run Code Online (Sandbox Code Playgroud)
我收到此错误 transform with key of translatex must be a number
如果我的变化multiply(scrollX, -1)
,以scrollX
动画逆转,
我该如何解决这个问题?
归档时间: |
|
查看次数: |
1346 次 |
最近记录: |