2
我遵循了原生做出反應洛蒂每一個例子,看着那個有同樣的問題一樣Lottie animation on Expo的問題,但我已經成功導入導出使用通過Bodymovin到以.json動畫陣營本地這裏:Lottie in react native無法找到圖像?
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>
);
}
}
我把它在一個視圖,所以這不是問題。動畫json文件沒有找到圖像,因此只顯示形狀(在Aftereffects中轉換爲形狀的矢量)。
我不明白爲什麼JSON不能找到圖像的路徑。我的圖片文件夾是在同一文件夾中以.json和我已經改變了這裏的路徑來匹配它從稱作類:
,"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"}
我如何使用作出反應本地和洛蒂導入圖像?這裏有什麼問題?