Skip to content

Commit 58d2081

Browse files
author
Zack Story
committed
update readme
1 parent dac9e22 commit 58d2081

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ import Drawer from 'react-native-drawer'
2626

2727
class Application extends Component {
2828
closeControlPanel = () => {
29-
this.refs.drawer.close()
29+
this._drawer.close()
3030
};
3131
openControlPanel = () => {
32-
this.refs.drawer.open()
32+
this._drawer.open()
3333
};
3434
render () {
3535
return (
3636
<Drawer
37-
ref="drawer"
37+
ref={(ref) => this._drawer = ref)}
3838
content={<ControlPanel />}
3939
>
4040
<MainView />
@@ -85,14 +85,19 @@ This module supports a wide range of drawer styles, and hence has *a lot* of pro
8585
- `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.
8686
- `closedDrawerOffset` (Number) `0` - Same as openDrawerOffset, except defines left hand margin when drawer is closed.
8787
- `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.
8889

8990
##### 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*/} }
9193
- `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)
9295

9396
##### Event Handlers
9497
- `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.
9599
- `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.
96101

97102
##### Gestures
98103
- `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
109114
- `initializeOpen` (Boolean) `false` - Initialize with drawer open?
110115
- `side` (String left|right) `left` - which side the drawer should be on.
111116

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-
118117
### Tween Handler
119118
You can achieve pretty much any animation you want using the tween handler with the transformMatrix property. E.G.
120119
```js
@@ -139,24 +138,23 @@ tweenHandler={(ratio) => {
139138
```
140139
Will result in a skewed fade out animation.
141140

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-
144141
### Opening & Closing the Drawer Programmatically
145142
Two options:
146143

147144
1. Using the Drawer Ref:
148145

149146
```js
150-
onPress={() => {this.drawer.open()}}
147+
// assuming ref is set up on the drawer as (ref) => this._drawer = ref
148+
onPress={() => {this._drawer.open()}}
151149
```
152150

153151
2. Using Context
154152

155153
```js
156154
contextTypes = {drawer: React.PropTypes.object}
157155
// later...
158-
this.context.drawer.open()
159-
```
156+
this.context.drawer.open()
157+
```
160158

161159
### Demo
162160
* `git clone https://github.com/rt2zz/react-native-drawer.git`

0 commit comments

Comments
 (0)