Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 动画未显示,洛蒂反应自然_Reactjs_React Native_Animation_Lottie_Lottie Android - Fatal编程技术网

Reactjs 动画未显示,洛蒂反应自然

Reactjs 动画未显示,洛蒂反应自然,reactjs,react-native,animation,lottie,lottie-android,Reactjs,React Native,Animation,Lottie,Lottie Android,我有一个react原生视图,其中有一个lottie动画,但是lottie动画根本不显示,屏幕只是黄色(封闭视图的背景色),请说明可能有什么问题,下面是我的代码 import React, { Component } from 'react'; import { StyleSheet, View, } from 'react-native'; import LottieView from 'lottie-react-native'; export default class Splas

我有一个react原生视图,其中有一个
lottie
动画,但是
lottie
动画根本不显示,屏幕只是黄色(封闭视图的背景色),请说明可能有什么问题,下面是我的代码

import React, { Component } from 'react';
import {
  StyleSheet,
  View, 
} from 'react-native';
import LottieView from 'lottie-react-native';

export default class Splash extends Component {
  constructor(props) {
    super(props);
  }

  static navigationOptions = {
    header: null,
  };

  render() {
    return (
      <View style={{flex: 1, backgroundColor: 'yellow'}}>
        <LottieView
          style={{flex: 1}}
          source={require('../check.json')}
          autoPlay
          loop
        />
      </View>
    );
  }
}
import React,{Component}来自'React';
进口{
样式表,
看法
}从“反应本机”;
从“lottie react native”导入LottieView;
导出默认类Splash扩展组件{
建造师(道具){
超级(道具);
}
静态导航选项={
标题:null,
};
render(){
返回(
);
}
}

我试用了您提供的乐透文件,它确实有效

下面是我在我的
App.js
中使用的代码

import React, {Component} from 'react';
import {Platform, StyleSheet, View} from 'react-native';
import LottieView from 'lottie-react-native';

export default class App extends Component<Props> {
  render() {
    return (
      <View style={styles.container}>
        <LottieView
          style={{flex: 1}}
          source={require('./check.json')} {/* I think your issue is that you have the wrong path for your lottie file*/}
          autoPlay
          loop
        />
      </View>
    );
  }
}
import React,{Component}来自'React';
从“react native”导入{Platform,StyleSheet,View};
从“lottie react native”导入LottieView;
导出默认类应用程序扩展组件{
render(){
返回(
);
}
}
注意在我的项目中,我的
App.js
和我的
check.json
在同一个文件夹中

这是一张它工作的照片


你的乐蒂动画行吗?你在其他地方测试过吗?是的,我从这里复制了一个动画