Permalink
Browse files

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 #13961

Differential Revision: D5479993

Pulled By: hramos

fbshipit-source-id: 4d29f695fbaf097d47f75b345b9998f61156f467
  • Loading branch information...
sadick254 authored and facebook-github-bot committed Jul 24, 2017
1 parent 9342f25 commit 3683ff8d951322344f21c0c62b97a06962787258
Showing with 16 additions and 1 deletion.
  1. +16 −1 Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js
@@ -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]);
},

0 comments on commit 3683ff8

Please sign in to comment.