如何使用react-native-animatable设置react native中文本组件内部的自定义组件的动画?

时间:2019-01-14 15:36:47

标签: react-native react-native-animatable

printf()

我是初学者,学习React Native Animation。如果您有时间,请帮助我。

我想将动画添加到MyCustomComponent,但是您能告诉我为什么这样做。谢谢。

1 个答案:

答案 0 :(得分:0)

您不能这样做,如果它是可动画的文本,则可以期望使tex动画,如果您想要嵌套视图,则将其包装在可动画的视图或普通视图中,并分别对文本和组件进行动画处理

<View>
<Animatable.Text style={styles.textStyle}>
      Made with{' '}
</Animatable.Text>
      <MyCustomComponent
        animation="pulse"
        iterationCount="infinite"
        name="ios-heart"
        style={{ fontSize: 18 }}
        color="red"
      />

 </View>

如果您发布预期结果的gif文件,将会很有帮助