Skip to content

Navigation bar not visible when using drawer menu #1354

Closed
@Manuel83

Description

@Manuel83

Version

"react-native-drawer": "^2.3.0",
"react-native-router-flux": "^3.36.0",
"react-native": "0.36.0",

I try to add a Drawer menu to my app. I took the code from the documentation. If I add the NavigationDrawer component to the wrapping scene element the navigation bar isn't displayed.

Any idea what's wrong in my code?

image

export default class App extends Component {
  render() {
    return (
        <View style={{ flex: 1 }}>
            <StatusBar
              backgroundColor="#ffffff00"
              barStyle="light-content"
              translucent
            />
            <Provider store={store}>
            <RouterWithRedux>
              <Scene key="drawer" open={true} >
                <Scene key="main" initial={true} component={Main} title="My APP"/>
                <Scene key="page1" component={Page1} title="Page 1"/>
              </Scene>
              </RouterWithRedux>
            </Provider>
          </View>
    )
  }
}

Drawer Navigation Code

export default class NavigationDrawer extends Component {
    constructor(props){
        super(props);
    }

    render(){
         const state = this.props.navigationState;
         const children = state.children;
         return (
             <Drawer
                 ref="navigation"
                 open={state.open}
                 onOpen={()=>Actions.refresh({key:state.key, open: true})}
                 onClose={()=>Actions.refresh({key:state.key, open: false})}
                 type="displace"
                 content={<SideMenu />}
                 tapToClose={true}
                 openDrawerOffset={0.2}
                 panCloseMask={0.2}
                 negotiatePan={true}
                 tweenHandler={(ratio) => ({
                  main: { opacity:Math.max(0.54,1-ratio) }
             })}>
                 <DefaultRenderer navigationState={children[0]} onNavigate={this.props.onNavigate} />
             </Drawer>
         );
     }

}

If I remove the DrawerNavigation form the first scene element the navigation bar is displayed again.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions