React-native-navigation: [v2] [Android] AppLayout defaults to white on launch

Created on 3 Sep 2018  路  7Comments  路  Source: wix/react-native-navigation

Issue Description

androidlaunchbug

RAW Video: https://streamable.com/jina7

The video explains the bug very well. On Android, when launching the app, I show my splash screen with setContentView in the Activity. Then when Navigation.setRootis executed, the launch screen is replaced with an white screen and gray NavBar (defaults?).

Few moments later, the expected screen options were applied and the app rendered.

I tried different configurations:

  • Very bad effect when using sidemenu or pure root.component.
  • It appears for shortest amount of time when using bottomTabs.
  • It appears for shorter amount of time on better device.
  • Settings default options did not work.

Steps to Reproduce / Code Snippets / Screenshots

Repro on current master: https://github.com/birkir/kvikmyndr-app

Navigation.setRoot({
  component: {
    name: WEEK,
  },
});

Environment

  • React Native Navigation version: 2.0.2515
  • React Native version: 0.56.rc-3
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): All
Android acceptebug v2 馃彋 stale

Most helpful comment

I think this can be closed. You can now override the default splash by doing

   @Override
   protected void addDefaultSplashLayout() {
       View view = new View(this);
       view.setBackgroundResource(R.drawable.launch_screen);
       setContentView(view);
   }

All 7 comments

The issue is caused by addDefaultSplashLayout on NavigationActivity setting by default a white view.

"Resolved" by overriding onCreate like this:

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        View view = new View(this);
        view.setBackgroundColor(Color.TRANSPARENT);
        setContentView(view);
    }

The addDefaultSplashLayout should be overridable.

@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); View view = new View(this); view.setBackgroundColor(Color.TRANSPARENT); setContentView(view); }

OR:

import com.reactnativenavigation.NavigationActivity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

public class MainActivity extends NavigationActivity
{
    @Override
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        View view = new View(this);
        view.setBackgroundResource(R.drawable.splash_screen);
        setContentView(view);
    }
}

@edvinasbartkus <3 <3 <3

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

I think this can be closed. You can now override the default splash by doing

   @Override
   protected void addDefaultSplashLayout() {
       View view = new View(this);
       view.setBackgroundResource(R.drawable.launch_screen);
       setContentView(view);
   }

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

The issue has been closed for inactivity.

Was this page helpful?
0 / 5 - 0 ratings