mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 03:50:11 +08:00
Update DrawerLayoutAndroid.android.js
Summary: Currently in the documentation is not clear on how to use the `openDrawer` and `closeDrawer` methods. There is no mention of the requirement to use refs in order to access the Drawer. This should make it clear on how to do the above. Closes https://github.com/facebook/react-native/pull/13961 Differential Revision: D5479993 Pulled By: hramos fbshipit-source-id: 4d29f695fbaf097d47f75b345b9998f61156f467
This commit is contained in:
committed by
Facebook Github Bot
parent
9342f25d5f
commit
3683ff8d95
@@ -270,7 +270,22 @@ var DrawerLayoutAndroid = createReactClass({
|
||||
null
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Closing and opening example
|
||||
* Note: To access the drawer you have to give it a ref. Refs do not work on stateless components
|
||||
* render () {
|
||||
* this.openDrawer = () => {
|
||||
* this.refs.DRAWER.openDrawer()
|
||||
* }
|
||||
* this.closeDrawer = () => {
|
||||
* this.refs.DRAWER.closeDrawer()
|
||||
* }
|
||||
* return (
|
||||
* <DrawerLayoutAndroid ref={'DRAWER'}>
|
||||
* </DrawerLayoutAndroid>
|
||||
* )
|
||||
* }
|
||||
*/
|
||||
_getDrawerLayoutHandle: function() {
|
||||
return ReactNative.findNodeHandle(this.refs[RK_DRAWER_REF]);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user