Json 洛蒂在react native can';找不到图像?

Json 洛蒂在react native can';找不到图像?,json,reactjs,react-native,lottie-android,Json,Reactjs,React Native,Lottie Android,我遵循了React-native的每个Lottie示例,并研究了具有相同问题的问题,如,但我已成功导入了一个动画,该动画通过Bodymovin使用React-native导出到.json,如下所示: import React, {Component} from 'react'; import Animation from 'lottie-react-native'; import { StyleSheet, Text, View, Animated, Easing, Sc

我遵循了React-native的每个Lottie示例,并研究了具有相同问题的问题,如,但我已成功导入了一个动画,该动画通过Bodymovin使用React-native导出到.json,如下所示:

import React, {Component} from 'react';
import Animation from 'lottie-react-native';
import {
  StyleSheet,
  Text,
  View,
  Animated,
  Easing,
  ScrollView,
  RefreshControl,
  AppRegistry
} from 'react-native';

export default class LottieTest extends Component {
  componentDidMount() {
    this.animation.play();
  }
  render()
  {
    //console.log(this.);
    return (
      <View>
      <Animation
        ref={animation => { this.animation = animation; }}
        style={{
          width: 500,
          height: 500
        }}
        source={require('./animations/btn1.json')}
      />
      </View>
    );
  }
}

如何使用React native和Lottie导入图像?这里怎么了?

动画图像应该直接添加到XCode和Android Studio项目中

因此,您应该在React原生项目中拥有.json文件,在ios/android项目中拥有图像资产

,"fr":29.9700012207031,"ip":0,"op":34.0000013848484,"w":861,"h":861,"nm":"button1","ddd":0,"assets":[{"id":"image_0","w":782,"h":782,"u":"../animations/images/","p":"img_0.png"}