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
## Description
I want to control the speed with which the drawer opens/closes.
Velocity does not seem to provide this functionality.
Adjusting the Animation.spring `speed` parameter does.
From the RN Animation docs here: https://reactnative.dev/docs/animated#spring
> speed: Controls speed of the animation. Default 12.
> ...
> velocity: The initial velocity of the object attached to the spring. Default 0 (object is at rest).
## Test plan
I manually tested the change my using different values for speed and comparing the results on device.
Co-authored-by: Jakub <[email protected]>
This is a cross-platform replacement for React Native's [DrawerLayoutAndroid](http://facebook.github.io/react-native/docs/drawerlayoutandroid.html) component. It provides a compatible API but allows for the component to be used on both Android and iOS. Please refer to [React Native docs](http://facebook.github.io/react-native/docs/drawerlayoutandroid.html) for the detailed usage for standard parameters.
11
11
@@ -26,18 +26,21 @@ On top of the standard list of parameters DrawerLayout has an additional set of
26
26
possible values are: `front`, `back` or `slide` (default is `front`). It specifies the way the drawer will be displayed. When set to `front` the drawer will slide in and out along with the gesture and will display on top of the content view. When `back` is used the drawer displays behind the content view and can be revealed with gesture of pulling the content view to the side. Finally `slide` option makes the drawer appear like it is attached to the side of the content view; when you pull both content view and drawer will follow the gesture.
@@ -80,6 +83,27 @@ Enables two-finger gestures on supported devices, for example iPads with trackpa
80
83
81
84
component or function. Children is a component which is rendered by default and is wrapped by drawer. However, it could be also a render function which takes an Animated value as a parameter that indicates the progress of drawer opening/closing animation (progress value is 0 when closed and 1 when opened) is the same way like `renderNavigationView` prop.
82
85
86
+
## Methods
87
+
88
+
89
+
### `openDrawer(options)`
90
+
91
+
`openDrawer` can take an optional `options` parameter which is an object, enabling further customization of the open animation.
92
+
93
+
`options` has two optional properties:
94
+
95
+
`velocity`: number, the initial velocity of the object attached to the spring. Default 0 (object is at rest).
96
+
`speed`: number, controls speed of the animation. Default 12.
97
+
98
+
### `closeDrawer(options)`
99
+
100
+
`closeDrawer` can take an optional `options` parameter which is an object, enabling further customization of the close animation.
101
+
102
+
`options` has two optional properties:
103
+
104
+
`velocity`: number, the initial velocity of the object attached to the spring. Default 0 (object is at rest).
105
+
`speed`: number, controls speed of the animation. Default 12.
106
+
83
107
## Example:
84
108
85
109
See the [drawer example](https://github.com/software-mansion/react-native-gesture-handler/blob/master/Example/horizontalDrawer/index.js) from [GestureHandler Example App](example.md) or view it directly on your phone by visiting [our expo demo](https://snack.expo.io/@adamgrzybowski/react-native-gesture-handler-demo).
0 commit comments