React-native-navigation: Hiding the topBar with mergeOptions doesn't have any effect on Android

Created on 11 Apr 2019  路  5Comments  路  Source: wix/react-native-navigation

Issue Description

I have a screen which has both portrait and landscape orientation. On orientation change, I'd like to toggle the topbar (hide in landscape and show it in portrait).

However, on Android, that does not work, the topbbar is all the time visible:

class MyComp {
// ...

    function componentDidAppear() {
        Dimensions.addEventListener('change',setDimState);
    }
    function componentDidDisappear() {
        Dimensions.removeEventListener('change',setDimState);
    }
    function setDimState(d:DimensionsData){
        if(state.lastScreenWidth==d.screen.width) return;
        setState({lastScreenWidth:d.screen.width});
    }
    function componentDidUpdate(pp,ps){
        if(ps.lastScreenWidth==0) return;
        if(ps.lastScreenWidth<state.lastScreenWidth){
            Navigation.mergeOptions.bind(
                props.componentId,
                {
                    topBar:{
                        visible:false,
                        height: 0
                    }
                }
            );
        }
        else {
            Navigation.mergeOptions.bind(
                props.componentId,
                {
                    topBar:{
                        visible:true,
                        height: null
                    }
                }
            );
        }
    }
//...
}

Environment

  • React Native Navigation version: 2.17.0
  • React Native version: 0.57.1
  • Platform(s) (iOS, Android, or both?): Android,
  • Device info (Simulator/Device? OS version? Debug/Release?): device, Android 8.0, debug
馃彋 stale

All 5 comments

I've just seen this : https://github.com/wix/react-native-navigation/issues/4768 which might be related as I am using a custom title component as a topbar...

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.

Why closing this issue when absolutely nobody gave yet any attention to it and the issue obviously still exists...

OK my issue was between the screen and the chair: I was calling Navigation.mergeOptions.bind( instead of Navigation.mergeOptions(...

Can we tag it as "dumb issue" please?

Was this page helpful?
0 / 5 - 0 ratings