【发布时间】:2022-01-30 00:00:27
【问题描述】:
我想使用动态布局的点击事件为我的 Animated.View 设置动画。我正在创建这样的参考
在构造函数中
this.HeadingAnimationRefs = []
然后在我的组件中
<Animated.View ref={ref => this.HeadingAnimationRefs[index] = ref}>
<Text style={styles.boldHeading}>Hello</Text>
</Animated.View>
在我的 onPress 方法上
onPress={() => console.log('Hi ', this.HeadingAnimationRefs[index].current)}
或
onPress={() => console.log('Hi ', this.HeadingAnimationRefs[index].props)}
请告诉我突出显示/动画视图的正确方法。我尝试过使用 TouchableOpacity,但以编程方式单击它时没有动画,所以我决定将它包装在 Animated.View 中,但现在我无法为 Animated.View 设置动画。
谢谢
【问题讨论】:
标签: javascript node.js reactjs react-native animation