Reactjs 有没有办法在道具上附加一个值?自然反应

Reactjs 有没有办法在道具上附加一个值?自然反应,reactjs,react-native,react-animated,react-animations,Reactjs,React Native,React Animated,React Animations,我当前的问题是,我的动画没有为指定的正确id激活: anim_star = (id) => { let progress = this.state.progress; progress[id] = new Animated.Value(0); this.setState({ progress }); console.log(this.state.progress); Animated.timing(this.state.progress, { toV

我当前的问题是,我的动画没有为指定的正确
id
激活:

    anim_star = (id) => {

  let progress = this.state.progress;
  progress[id] = new Animated.Value(0);

    this.setState({ progress });
console.log(this.state.progress);
  Animated.timing(this.state.progress, {
    toValue: 1,
    duration: 2000,
    easing: Easing.linear,
  }).start();

}
控制台的
结果如下:

在看到
10:AnimatedValue
的地方,
10
表示我为该动画单击的
id
。由于某些原因,动画未在
10
中播放

下面是我尝试将正确的
id
附加到
AnimatedValue

   <TouchableOpacity
         onPress={this.anim_like.bind(this, item.id)}>
          <Animation
          progress={this.state.progress[item.id]} // Here is where I think I need to fix.
          source={require('../Animations/favourite_app_icon.json')}

          />
          </TouchableOpacity>


有没有办法模仿我在
控制台.log中所做的事情?
什么是“动画”组件。对于必须使用的其他组件,您只能为其设置
视图
文本
图像
滚动视图
的动画。检查react原生文档。首先检查动画是否在没有提供任何id的情况下工作,然后使用id使其工作,这样可以调试错误。@RaviRaj fromLottie@RaviRaj此外,是的,动画没有id的作品,但没有id的所有动画播放在同一时间。对不起,我不能掌握你的代码。但请尝试此更改,在动画开始的
动画.timing
行中,将
this.state.progress
更改为
this.state.progress[id]
。它可能会起作用。@RaviRaj当我添加[id]时,控制台日志结果为空。我能做些什么来帮助您理解我的代码?