我有一个TextView,它将fadeOutDown旧数据,并在下一次渲染时fadeInDown新数据。我该如何做到这一点?我正在使用react-native-animatable库,并且已经成功地制作了一个动画,但不知道如何制作两个动画。
<Animatable.View animation={this.props.animation} style = {styles.innerView2}>
<Text text = "abcd" style = {{alignItems: 'flex-start', width: DEVICE_WIDTH - 20, textAlign: 'left'}}/>
</Animatable.View>发布于 2018-09-03 21:18:57
为可设置动画的组件分配一个ref,然后例如在componentDidUpdate上,您可以重新触发动画
componentDidUpdate() {
if (this.view !== undefined && this.view !== null) {
this.view.fadeIn(1000);
}
}
<Animatable.View
ref={ref => (this.view = ref)}
animation="fadeIn"
easing="ease-in">
<Text>{this.state.newText}</Text>
</Animatable.View>这里有一个供您参考的snack
https://stackoverflow.com/questions/52150383
复制相似问题