0

我有安卓的问题。未找到 Android 资产目录中的文件。

错误:

更新由 LottieAnimationView 管理的视图的属性“sourceName”时出错

无效的

找不到文件 loading.js

动画文件位置:

app/src/main/assets/loading.json

零件:

class Loading extends Component {

  componentDidMount() {
    this.animation.play()
  }

  render() {
    return (
      <View style={StyleSheet.loading.page}>
        <View style={StyleSheet.loading.animationWrapper}>
          <Animation
            ref={animation => { this.animation = animation }}
            style={StyleSheet.loading.animation}
            loop
            source="loading.json"
          />
        </View>
        <Text style={StyleSheet.loading.text}>LOADING</Text>
      </View>
    )
  }
}

版本:

"lottie-react-native": "2.2.0"
"react-native": "0.47.2"
4

1 回答 1

0

你应该在你的javascript源代码中添加你的loading.json文件并需要它

<Animation
   ref={animation => { this.animation = animation }}
   style={StyleSheet.loading.animation}
   loop
   source={require('./loading.json')}
/>
于 2017-09-21T16:09:26.307 回答