【问题标题】:react-native background blank flicks when loading different scenes加载不同场景时反应原生背景空白笔触
【发布时间】:2019-12-29 21:32:42
【问题描述】:

我正在开发适用于 iOS/Android 的 react-native 应用程序,我在 wix-navigation v2 中具有以下结构:

SplashScreenView (stack)
   |_> if user is logged in, starts tabBasedApp (stack)
   |_> if user is not logged in, goes to AuthView (stack)

我的应用背景是绿色的。因此,每当我启动应用程序(PROD/Release)时,我都会在加载每个场景之前看到空白的白色闪烁背景。看起来很糟糕。

应用启动 = 白色加载大约 1-2 秒,然后 SplashScreen 进入视图,结束 SplashScreen 动画,然后是另一个轻弹,因为它正在加载下一个基于 tab 的屏幕。

这是一个“RootView”问题吗?我该如何解决这个细节?

更新:在 styles.xml 中添加以下颜色设置后,它有点工作,但每当我第一次打开应用程序时,还有 1 个空白卡住的时刻我无法修复。

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
  <item name="android:colorBackground">@color/custom_theme_color</item>
</style>

一旦应用程序被打开并最小化,再次打开,这个空白就再也不会发生了。这是什么原因?

【问题讨论】:

    标签: react-native react-native-navigation


    【解决方案1】:

    这是 react-native-splash-screen 的错误配置。正确安装并设置正确的styles.xml和colors.xml后,它就可以工作了。

    如果有人遇到同样的情况,这是我的styles.xml文件:

    <resources>
    
        <!-- Base application theme. -->
        <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
            <item name="android:windowBackground">@drawable/splash_gradient_bg</item>
            <item name="android:statusBarColor">@color/custom_theme_color</item>
        </style>
    
        <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
            <item name="android:windowIsTranslucent">true</item>
            <item name="android:windowBackground">@drawable/splash_gradient_bg</item>
            <item name="android:statusBarColor">@color/custom_theme_color</item>
        </style>
    
    </resources>
    

    【讨论】:

      猜你喜欢
      • 2013-01-05
      • 1970-01-01
      • 1970-01-01
      • 2018-05-04
      • 2023-03-28
      • 2019-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多