[英]React Native AppLoading without Expo
I've used expo for a while now and have switched to react-native-init without expo.我已经使用 expo 一段时间了,并且在没有 expo 的情况下切换到 react-native-init。
I've been very comfortable working without expo (thanks Github) but somehow I am unable to find a solution with much googling, for a similar feature to AppLoading in Expo ( https://docs.expo.io/versions/latest/sdk/app-loading ).我在没有 expo 的情况下工作很舒服(感谢 Github),但不知何故,我无法通过大量谷歌搜索找到一个解决方案,用于与 Expo 中的 AppLoading 类似的功能( https://docs.expo.io/versions/latest/sdk /应用程序加载)。 Maybe I'm not using the correct keywords, I keep getting results for react native fast image etc which just preload images from cache.也许我没有使用正确的关键字,我不断得到反应原生快速图像等的结果,这些结果只是从缓存中预加载图像。
I've already set up the Launch screen in Xcode, I would like to network request, load some data into my redux store, preload images and some fonts, before my Launch screen switches to my first screen .我已经在 Xcode 中设置了启动屏幕,我想在启动屏幕切换到我的第一个屏幕之前进行网络请求,将一些数据加载到我的 redux 存储中,预加载图像和一些字体。
Can someone provide me with a solution or a link to the solution?有人可以为我提供解决方案或解决方案的链接吗?
react-native-splash-screen满足您的要求!
As of 2021,截至 2021 年,
You may try https://github.com/zoontek/react-native-bootsplash你可以试试https://github.com/zoontek/react-native-bootsplash
In case, react-native-splash-screen
is not suitable for you.以防万一, react-native-splash-screen
不适合您。
I managed it to just do a simple loading placeholder.我设法只做了一个简单的加载占位符。 While loading you have loadingState == true.加载时,您有 loadingState == true。 If it finished to fetch user data eg it will load your normal screen, navigation or whatever如果它完成了获取用户数据,例如它将加载您的正常屏幕、导航或其他任何内容
if (loginState == true){
return(
<View style={{flex: 1, justifyContent: "center", alignItems: "center", backgroundColor: "#000000"}}>
<Text style={{color: "#FFFFFF", fontSize: 27, fontFamily: "Poppins-SemiBold"}}>Loading</Text>
<ActivityIndicator size="large" color="#FFFFFF" />
</View>
)
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.