2017-06-06 42 views
3

我有一個默認的反應本地的項目,我安裝了這Turorial,我剛添加閃屏到我的項目與This Tutorial,但我得到了第一:啓動畫面後如何刪除白色屏幕的陣營原分辨率的Android

  • 0.5 SECEND閃屏照片
  • 然後1.5 SECEND白屏
  • 在那之後我的應用程序開始,

什麼是解決這個問題的最好和標準方法? 我需要只是1 secend初始屏幕的標準預裝和該應用程序啓動後, 我看了更多的文章,但我coudn't修復通過反應原生。

<application 
    android:name=".MainApplication" 
    android:allowBackup="true" 
    android:label="@string/app_name" 
    android:icon="@mipmap/ic_launcher" 
    android:theme="@style/AppTheme"> 
    <activity 
    android:name=".SplashActivity" 
    android:label="@string/app_name" 
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize" 
    android:windowSoftInputMode="adjustResize" 
    android:theme="@style/SplashTheme"> 
    <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 
     <category android:name="android.intent.category.LAUNCHER" /> 
    </intent-filter> 
    </activity> 
    <activity android:name=".MainActivity" /> 
    <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> 
</application> 

回答

1

下面是ios和android的另一種解決方案:https://github.com/mehcode/rn-splash-screen。 我將啓動畫面隱藏在我的app.tsx(入口點)的渲染函數中,並顯示相同的圖像,直到完成所有的https請求。

我的代碼:

public render() 
    { 
     SplashScreen.hide(); 

     //after everything has finished loading - show my app. 
     if (this.state.isFinishedloading) 
     { 
      return (
       <this.navigator screenProps={{ ...providers }} /> 
      ); 
     } 

     // Until then show the same image as the splash screen with an ActivityIndicator. 
     return (
      <View style={{ flex: 1 }}> 
       <Image style={styles.image} source={require('../assets/img/splash.png')} > 
       <ActivityIndicator style={styles.indicator} color="#fff"></ActivityIndicator> 
       </Image> 
      </View> 
     ); 

    } 
0

有了這個問題,花了很多時間在調試。

解決方案:CSS屬性在我的一個組件中複製。刪除重複固定的白屏問題給我。