Skip to content

Commit

Permalink
Update DrawerLayoutAndroid.android.js
Browse files Browse the repository at this point in the history
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 3683ff8
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
},
Expand Down

0 comments on commit 3683ff8

Please sign in to comment.