Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {

/**
* Closing and opening example
* Note: To access the drawer you have to give it a ref. Refs do not work on stateless components
* Note: To access the drawer you have to give it a ref
*
* Class component:
*
* render () {
* this.openDrawer = () => {
* this.refs.DRAWER.openDrawer()
Expand All @@ -298,9 +301,25 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
* }
* return (
* <DrawerLayoutAndroid ref={'DRAWER'}>
* {children}
* </DrawerLayoutAndroid>
* )
* }
*
* Function component:
*
* const drawerRef = useRef()
* const openDrawer = () => {
* drawerRef.current.openDrawer()
* }
* const closeDrawer = () => {
* drawerRef.current.closeDrawer()
* }
* return (
* <DrawerLayoutAndroid ref={drawerRef}>
* {children}
* </DrawerLayoutAndroid>
* )
*/
_getDrawerLayoutHandle() {
return ReactNative.findNodeHandle(this._nativeRef.current);
Expand Down