You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-15Lines changed: 13 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,15 +26,15 @@ import Drawer from 'react-native-drawer'
26
26
27
27
classApplicationextendsComponent {
28
28
closeControlPanel= () => {
29
-
this.refs.drawer.close()
29
+
this._drawer.close()
30
30
};
31
31
openControlPanel= () => {
32
-
this.refs.drawer.open()
32
+
this._drawer.open()
33
33
};
34
34
render () {
35
35
return (
36
36
<Drawer
37
-
ref="drawer"
37
+
ref={(ref) =>this._drawer= ref)}
38
38
content={<ControlPanel />}
39
39
>
40
40
<MainView />
@@ -85,14 +85,19 @@ This module supports a wide range of drawer styles, and hence has *a lot* of pro
85
85
-`openDrawerOffset` (Number) `0` - Can either be a integer (pixel value) or decimal (ratio of screen width). Defines the right hand margin when the drawer is open.
86
86
-`closedDrawerOffset` (Number) `0` - Same as openDrawerOffset, except defines left hand margin when drawer is closed.
87
87
-`disabled` (Boolean) `false` - If true the drawer can not be opened and will not respond to pans.
88
+
-`styles` (Object) `null` - Styles for the drawer, main and mainOverlay container Views.
88
89
89
90
##### Animation / Tween
90
-
-`tweenHandler` (Function) `null` - Takes in the pan ratio (decimal 0 to 1) that represents the tween percent. Returns and object of native props to be set on the constituent views { drawer: {/*native props*/}, main: {/*native props*/} }
91
+
**Note**: In the future animations with use Animated, and the api will change.
92
+
-`tweenHandler` (Function) `null` - Takes in the pan ratio (decimal 0 to 1) that represents the tween percent. Returns and object of native props to be set on the constituent views { drawer: {/*native props*/}, main: {/*native props*/}, mainOverlay: {/*native props*/} }
91
93
-`tweenDuration` (Integer) `250` - The duration of the open/close animation.
94
+
-`tweenEasing` (String) `linear` - A easing type supported by [tween-functions](https://www.npmjs.com/package/tween-functions)
92
95
93
96
##### Event Handlers
94
97
-`onOpen` (Function) - Will be called immediately after the drawer has entered the open state.
98
+
-`onOpenStart` (Function) callback fired at the start of an open animation.
95
99
-`onClose` (Function) - Will be called immediately after the drawer has entered the closed state.
100
+
-`onCloseStart` (Function) callback fired at the start of a close animation.
96
101
97
102
##### Gestures
98
103
-`captureGestures` (oneOf(true, false, 'open', 'closed')) `open` - If true, will capture all gestures inside of the pan mask. If 'open' will only capture when drawer is open.
@@ -109,12 +114,6 @@ This module supports a wide range of drawer styles, and hence has *a lot* of pro
109
114
-`initializeOpen` (Boolean) `false` - Initialize with drawer open?
110
115
-`side` (String left|right) `left` - which side the drawer should be on.
111
116
112
-
##### Experimental & Deprecated Props
113
-
**Subject to change or deletion**
114
-
-`onOpenStart` (Function) callback fired at the start of an open animation
115
-
-`onCloseStart` (Function) callback fired at the start of a close animation
116
-
-`tweenEasing` (String) `linear` - A easing type supported by [tween-functions](https://www.npmjs.com/package/tween-functions)
117
-
118
117
### Tween Handler
119
118
You can achieve pretty much any animation you want using the tween handler with the transformMatrix property. E.G.
120
119
```js
@@ -139,24 +138,23 @@ tweenHandler={(ratio) => {
139
138
```
140
139
Will result in a skewed fade out animation.
141
140
142
-
**warning:** Frame rate, and perceived smoothness will vary based on the complexity and speed of the animation. It will likely require some tweaking and compromise to get the animation just right.
143
-
144
141
### Opening & Closing the Drawer Programmatically
145
142
Two options:
146
143
147
144
1. Using the Drawer Ref:
148
145
149
146
```js
150
-
onPress={() => {this.drawer.open()}}
147
+
// assuming ref is set up on the drawer as (ref) => this._drawer = ref
0 commit comments