且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 iOS 11 上启动屏幕后应用程序闪烁白色?

更新时间:2023-01-25 21:44:57

好的,我想我找到了问题所在.在 AppDelegate.m 中,rootView 默认为白色背景,当我启动应用程序时,它会从以下位置转换:启动屏幕 -> rootView -> React Native 视图.

Ok, I think I found the issue. In AppDelegate.m, the rootView has a white background color as default, and when I start the app it transitions from: Launch screen -> rootView -> React Native view.

在 iOS 10 上,我从未看到 rootView 闪过,但在 iOS 11 上,RN 视图加载之前似乎有很短的延迟.我不确定为什么会在 iOS 11 而不是 10 上发生这种情况,但您可以通过以下任一方式解决:

On iOS 10 I never saw the rootView flash by, but on iOS 11 there seems to be a short delay before the RN view is loaded. I'm not sure why this happens on iOS 11 and not 10, but you can solve this by either:

  1. 在 rootView 上设置背景颜色以匹配启动屏幕.
  2. 将启动屏幕设置为 rootView 的背景.这是一个指南:https://peterminarik.tumblr.com/post/153039209421/how-to-fix-the-initial-white-flash-in-your-react