React-native-navigation: [v6 Android] setDefaultOptions statusBar drawBehind not working

Created on 27 Feb 2020  路  11Comments  路  Source: wix/react-native-navigation

Issue Description

When setting statusBar: { drawBehind: true } as default option, it is not respected on Android. Only when setting it via static options () it is being applied.

Steps to Reproduce / Code Snippets / Screenshots

Navigation.setDefaultOptions({
    statusBar: {
      style: 'light',
      backgroundColor: '#ff6600',
      drawBehind: true,
    },
})

Environment

  • React Native Navigation version: v6.0.1
  • React Native version: v0.61.5
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): Emulator API 28
Android acceptebug

Most helpful comment

@guyca Thank you! I'll investigate.

All 11 comments

Issue also present when used with mergeOptions i.e. drawBehind is not respected. no relayout happens when drawBehind is set again to false.
My use case is a video player where I use mergeOptions to change statusBar config on fullscreen and vice versa.
Here is the usage:

  onEnterFullScreen = () => {
    StatusBar.setHidden(true, true);
    Utils.updateScreenOptions({
      statusBar: {
        visible: false,
        drawBehind: true,
      },
    });
    this.setState({
      videoFullScreen: true,
      currentOrientation: this.state.preferredVideoOrientation
    });
    this.props.onEnterFullScreen && this.props.onEnterFullScreen();
  };

  onExitFullScreen = () => {
    StatusBar.setHidden(false, true);
      Utils.updateScreenOptions({
        statusBar: {
          visible: true,
          drawBehind: false,
        },
      });
    this.setState({
      videoFullScreen: false,
      currentOrientation: 'portrait'
    });
    this.props.onExitFullScreen && this.props.onExitFullScreen();
  };

SYSTEM_UI_FLAG_LAYOUT_STABLE seems to be already set, when I checked Presenter.java -> mergeStatusBarVisible method.
I would like my content to re-layout when statusbar is visible again and not draw behind the status bar when exited from fullscreen.

Multiple guides are here with android doc:
https://developer.android.com/training/system-ui/navigation
https://developer.android.com/training/system-ui/status#behind

+1

same issue

@guyca is this hard to solve? I'm trying to solve this issue, but after change the code i have to wait 30s of build time.

+1

@mayconmesquita This should be a fairly easy fix.
The ComponentViewController should request the topInsets from the presenter, where we need to merge the resolved options with the default options.

Similar to how bottom insets are applied for bottom tabs here

I have the same issue.

@guyca Thank you! I'll investigate.

Hey guys any ETA on this one? Unfortunately I can not use static options() as I'm on ES5 (hints how to get it working on ES5 are appreciated).

@serjek unfortunately i don't know a ETA. I tried to fix this, but i didn't.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kiroukou picture kiroukou  路  3Comments

henrikra picture henrikra  路  3Comments

birkir picture birkir  路  3Comments

switchtrue picture switchtrue  路  3Comments

EliSadaka picture EliSadaka  路  3Comments