Answer the question
In order to leave comments, you need to log in
React Native, how do components "communicate"?
There are three components, DrawerLayoutAndroid, DrawerNav, MainView (DrawerLayoutAndroid contains the rest inside).
There is an event handler onDrawerClose. How can I change some properties or the state of the DrawerNav and MainView components inside this handler?
(
<DrawerLayoutAndroid
drawerWidth={300}
drawerPosition={DrawerLayoutAndroid.positions.Left}
renderNavigationView={()=> (<DrawerNav />)}
onDrawerClose={function(){
// ???????
}}
>
<MainView />
</DrawerLayoutAndroid>
)
Answer the question
In order to leave comments, you need to log in
You need to set the state in the handler, and then set it in the renderer.
(
<DrawerLayoutAndroid
drawerWidth={300}
drawerPosition={DrawerLayoutAndroid.positions.Left}
renderNavigationView={()=> (<DrawerNav open={this.state.navOpen} />)}
onDrawerClose={() => this.setState({navOpen: true})}
>
<MainView />
</DrawerLayoutAndroid>
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question