Animation 在自定义组件中反应本机动画

Animation 在自定义组件中反应本机动画,animation,react-native,Animation,React Native,我使用此道具创建自定义组件: 不透明度:PropTypes.number,//不透明度; 在一个页面中,我使用它来支持动画。 const AnimatedProgress=Animated.createAnimatedComponent(RecorderProgress); 然后,我设置一个不透明度状态。 this.state={u不透明:新的动画.Value(0)} 并在componentDidMount中设置动画; 动画。计时(此。状态。\u不透明度{ toValue:1,//

我使用此道具创建自定义组件:

不透明度:PropTypes.number,//不透明度;

在一个页面中,我使用它来支持动画。

const AnimatedProgress=Animated.createAnimatedComponent(RecorderProgress);

然后,我设置一个不透明度状态。

this.state={u不透明:新的动画.Value(0)}

并在componentDidMount中设置动画;

动画。计时(此。状态。\u不透明度{
toValue:1,//不透明;
持续时间:5000
}).start();

将组件添加到页面:

但是当我运行应用程序时,组件没有动画

我还发现,如果我直接在组件的样式中创建一个不透明度,而不是给它一个不透明度道具,动画就会工作。

拜托,我很困惑,有人能帮我吗?谢谢