本地博览会中的Lottie动画

时间:2020-02-23 19:30:31

标签: android react-native svg lottie

我正在尝试第一次在我的react native expo项目中使用json文件实现Lottie动画,但是没有任何显示:

我还为构建分级机添加了"implementation": "com.airbnb.android:lottie:$lottieVersion",依赖项,但没有用。

以下是我的渲染代码:

    if(this.props.navigation.getParam('city')){
        this.getWeather()
    }
  return (
    <View style={styles.container}>
      <Header title="Current Weather" />
      <Card style={{margin: 20, backgroundColor:"#30336b" }} >
                <View style={{padding:20, alignItems:'center'}} >
            <Title style={styles.text1}>{this.state.info.name}</Title>
            <Image  style={{width:120, height:120}}
                source={{uri:'http://openweathermap.org/img/w/'+this.state.info.icon+".png"}}
             />
            <Title style={styles.text2} >TEMPERATURE : {this.state.info.temp} °C</Title>
            <Title style={styles.text2}>DESCRIPTION : {this.state.info.desc}</Title>
            <Title style={styles.text2}>HUMIDITY : {this.state.info.humidity}</Title>
        </View>
        <LottieView
        source={require('../lottie/16406-colorfull-loader(1).json')}
        autoPlay
        loop
      />
      </Card>

    </View>
  );
}```


0 个答案:

没有答案