react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

[v2] Android Navigation.setRoot with a stack layout and topBar hidden leaves empty space at the top

Open mahyarr opened this issue 8 years ago • 4 comments

First of all, thanks a lot for this library. It's life-saver. Today I've been migrating from v1 to v2 and Im facing some problems so excuse me for all the issues I'm creating today :)

Issue Description

I want to initialize the app with a stack layout and the topBar hidden. So I'm using the following code to do so:

Navigation.events().registerAppLaunchedListener(() => {
  Navigation.setDefaultOptions({
    topBar: {
      visible: false,
    },
  });
  Navigation.setRoot({
    stack: {
      children: [{
        component: {
          id: 'xxxx',
          name: 'xxxx',
        },
      }],
    },
  });
});

This code works great on iOS but on Android, the app launches with the topBar briefly visible, then it animates away but leaves the space at the top empty.

Steps to Reproduce / Code Snippets / Screenshots

Explained above.


Environment

  • React Native Navigation version: 2.0.2291
  • React Native version: 0.55.4
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): iPhone 7p iOS 11.3 Debug

mahyarr avatar May 18 '18 03:05 mahyarr

This also happens to me as well. Also for some reason, about bottom 50px of the screen is not responding to the touch.

jinshin1013 avatar May 18 '18 04:05 jinshin1013

Found the solution. You need to add drawBehind: true to topBar Style

jinshin1013 avatar May 18 '18 04:05 jinshin1013

@jinshin1013 Nice, that solved the problem of empty space at the top.

But the topBar still shows up briefly and then animates away. Would be nice to disable that behaviour. I tried doing it from the native side (both on MainActivity and AndroidManifest) with no luck.

mahyarr avatar May 18 '18 14:05 mahyarr

@mahyarr I'm closing and will address the flashing TopBar in #3016

guyca avatar May 18 '18 16:05 guyca