【发布时间】:2022-08-10 09:48:18
【问题描述】:
我为我的应用程序制作了一个简单的初始加载动画——它曾经完美运行,现在在我的 iOS 模拟器上仍然完美运行。但是,尝试通过 LAN 在我的 iOS 设备上运行 LottieView 完全没有显示,以及如果我发布构建并将其部署到 iOS App Store。不过有趣的是,如果我继续更改任何 LottieView 属性,然后快速刷新——它将开始在我的设备上显示。
我一直在搜索论坛,但我经常发现 LottieView 在 Android 上工作的问题——我知道这是因为冲突,但没有人能够从我所看到的情况中真正得到这个特定问题。有任何想法吗?
这是我的代码:
return (
<View
style={{
backgroundColor: \"white\",
flex: 1,
justifyContent: \"center\",
alignItems: \"center\",
}}
>
<LottieView
style={{ width: 150, height: 150 }}
source={require(\"../assets/data.json\")}
autoPlay={true}
loop={true}
speed={2}
/>
{Platform.OS === \"android\" && (
<Image
style={{ width: \"100%\", resizeMode: \"contain\" }}
source={require(\"../assets/splash.png\")}
/>
)}
{isLoading && Platform.OS === \"android\" ? (
<View style={{ position: \"absolute\", bottom: \"32%\" }}>
<Spinner size=\"giant\" />
</View>
) : null}
{isError ? (
<Text
category=\"label\"
style={{ fontSize: 20, textAlign: \"center\", color: \"grey\" }}
>
No Internet Connection
</Text>
) : null}
</View>
这是我得到的 package-lock.json:
\"lottie-ios\": {
\"version\": \"3.2.2\",
\"resolved\": \"https://registry.npmjs.org/lottie-ios/-/lottie-ios-3.2.2.tgz\",
\"integrity\": \"sha512-buYj/HbzoTeqiVy+Hpzfd2STdRW7RJnne+09z48nVvBYO+ioG5B5EvRb92pYOoRDNr0stQpfurzK1uFXW4gGCA==\"
},
\"lottie-react-native\": {
\"version\": \"2.6.1\",
\"resolved\": \"https://registry.npmjs.org/lottie-react-native/-/lottie-react-native-2.6.1.tgz\",
\"integrity\": \"sha512-Z+6lARvWWhB8n8OSmW7/aHkV71ftsmO7hYXFt0D+REy/G40mpkQt1H7Cdy1HqY4cKAp7EYDWVxhu5+fkdD6o4g==\",
\"requires\": {
\"invariant\": \"^2.2.2\",
\"lottie-ios\": \"2.5.0\",
\"prop-types\": \"^15.5.10\",
\"react-native-safe-module\": \"^1.1.0\"
},
\"dependencies\": {
\"lottie-ios\": {
\"version\": \"2.5.0\",
\"resolved\": \"https://registry.npmjs.org/lottie-ios/-/lottie-ios-2.5.0.tgz\",
\"integrity\": \"sha1-VcgI54XUppM7DBCzlVMLFwmLBd4=\"
}
}
},
这是 package.json:
\"lottie-ios\": \"^3.1.8\",
\"lottie-react-native\": \"5.0.1\",
-
请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如它目前所写的那样,很难准确地说出你在问什么。
标签: ios reactjs react-native expo lottie