在 iOS 11 上启动屏幕后应用程序闪烁白色? [英] App flashing white after launch screen on iOS 11?

查看:41
本文介绍了在 iOS 11 上启动屏幕后应用程序闪烁白色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我将手机更新到 iOS 11 后,我注意到我的 React Native 应用程序在启动屏幕和应用程序的第一个屏幕之间短暂(<0.5 秒)闪烁为白色.由于我的应用具有深色背景和深色启动屏幕,因此这一点尤为明显.

Since I updated my phone to iOS 11 I have noticed that my React Native app briefly (<0.5s) flashes to white between the launch screen and the first screen of the app. This is extra noticeable since my app has a dark background and a dark launch screen.

我一开始以为我可能忘记了某个地方有一个白色背景的视图,但是当我创建了一个全新的应用程序并将启动屏幕设置为红色和默认 App.js 的背景时(欢迎使用 React Native...) 到红色,这也很明显.

I first thought I might have forgotten a view with a white background somewhere, but when I created a whole new app and set the launch screen to red and the background of the default App.js (Welcome to React native...) to red, this is very noticeable as well.

需要说明的是,这种情况发生在打包发布版本中.从远程打包程序加载时,我会接受调试版本中的一些延迟,但我之前发布版本没有这个问题.

Just to be clear, this is happening with packaged release builds. I would accept some lag in debug builds when loading from the remote packager, but I didn't have this issue with release builds before.

还有其他人遇到这个烦人的问题吗?

Anyone else having this annoying problem?

推荐答案

好的,我想我找到了问题所在.在 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

这篇关于在 iOS 11 上启动屏幕后应用程序闪烁白色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆