Skip to content

Commit 51ee7c6

Browse files
committedDec 9, 2024·
Merge branch '@latekvo/remove-deprecated-components' of https://github.com/software-mansion/react-native-gesture-handler into @latekvo/remove-deprecated-components
2 parents 5599019 + da340f2 commit 51ee7c6

36 files changed

+371
-3868
lines changed
 

‎FabricExample/ios/Podfile.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ PODS:
15091509
- React-logger (= 0.76.0)
15101510
- React-perflogger (= 0.76.0)
15111511
- React-utils (= 0.76.0)
1512-
- RNGestureHandler (2.21.1):
1512+
- RNGestureHandler (2.21.2):
15131513
- DoubleConversion
15141514
- glog
15151515
- hermes-engine
@@ -1743,7 +1743,7 @@ SPEC CHECKSUMS:
17431743
fmt: 10c6e61f4be25dc963c36bd73fc7b1705fe975be
17441744
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
17451745
hermes-engine: 9de51d2f67336348a6cd5b686330e436d1dbd522
1746-
RCT-Folly: bf5c0376ffe4dd2cf438dcf86db385df9fdce648
1746+
RCT-Folly: 84578c8756030547307e4572ab1947de1685c599
17471747
RCTDeprecation: 4c2c4a088b6f0ccfcbd53c9d5614b0238ad57909
17481748
RCTRequired: 2d8a683a7848bc0baf5883f0792c1ac43f6267b5
17491749
RCTTypeSafety: 23df4344c69c602e1c5a8053a93c633af1bee825
@@ -1799,9 +1799,9 @@ SPEC CHECKSUMS:
17991799
React-utils: e74516d5b9483c5530ec61e249e28b88729321d2
18001800
ReactCodegen: ff7512e124e3dc1363a4930a209d033354d2042a
18011801
ReactCommon: cde69a75746e8d7131f61c27155ee9dc42117003
1802-
RNGestureHandler: 39ce07f10bbd98e5810ee79780ed3d6c02fafeb2
1802+
RNGestureHandler: a1d7f6a6b72f4f57127df353cbe06955b6354fd7
18031803
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
1804-
Yoga: f8ec45ce98bba1bc93dd28f2ee37215180e6d2b6
1804+
Yoga: 1d66db49f38fd9e576a1d7c3b081e46ab4c28b9e
18051805

18061806
PODFILE CHECKSUM: 0789d64718cebced7436c418e1f61d0aa9d54889
18071807

‎FabricExample/yarn.lock

+1-13
Original file line numberDiff line numberDiff line change
@@ -1128,13 +1128,6 @@
11281128
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
11291129
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
11301130

1131-
"@egjs/hammerjs@^2.0.17":
1132-
version "2.0.17"
1133-
resolved "https://registry.yarnpkg.com/@egjs/hammerjs/-/hammerjs-2.0.17.tgz#5dc02af75a6a06e4c2db0202cae38c9263895124"
1134-
integrity sha512-XQsZgjm2EcVUiZQf11UBJQfmZeEmOW8DpI1gsFeln6w0ae0ii4dMQEQ0kjl6DspdWX1aGY1/loyXnP0JS06e/A==
1135-
dependencies:
1136-
"@types/hammerjs" "^2.0.36"
1137-
11381131
"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
11391132
version "4.4.0"
11401133
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59"
@@ -1902,11 +1895,6 @@
19021895
dependencies:
19031896
"@types/node" "*"
19041897

1905-
"@types/hammerjs@^2.0.36":
1906-
version "2.0.45"
1907-
resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.45.tgz#ffa764bb68a66c08db6efb9c816eb7be850577b1"
1908-
integrity sha512-qkcUlZmX6c4J8q45taBKTL3p+LbITgyx7qhlPYOdOHZB7B31K0mXbP5YA7i7SgDeEGuI9MnumiKPEMrxg8j3KQ==
1909-
19101898
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1":
19111899
version "2.0.6"
19121900
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7"
@@ -5630,7 +5618,7 @@ prompts@^2.0.1, prompts@^2.4.2:
56305618
kleur "^3.0.3"
56315619
sisteransi "^1.0.5"
56325620

5633-
prop-types@^15.7.2, prop-types@^15.8.1:
5621+
prop-types@^15.8.1:
56345622
version "15.8.1"
56355623
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
56365624
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==

‎MacOSExample/Gemfile.lock

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,27 @@ GEM
55
base64
66
nkf
77
rexml
8-
activesupport (7.2.1)
8+
activesupport (7.1.5)
99
base64
10+
benchmark (>= 0.3)
1011
bigdecimal
11-
concurrent-ruby (~> 1.0, >= 1.3.1)
12+
concurrent-ruby (~> 1.0, >= 1.0.2)
1213
connection_pool (>= 2.2.5)
1314
drb
1415
i18n (>= 1.6, < 2)
1516
logger (>= 1.4.2)
1617
minitest (>= 5.1)
18+
mutex_m
1719
securerandom (>= 0.3)
18-
tzinfo (~> 2.0, >= 2.0.5)
20+
tzinfo (~> 2.0)
1921
addressable (2.8.7)
2022
public_suffix (>= 2.0.2, < 7.0)
2123
algoliasearch (1.27.5)
2224
httpclient (~> 2.8, >= 2.8.3)
2325
json (>= 1.5.1)
2426
atomos (0.1.3)
2527
base64 (0.2.0)
28+
benchmark (0.4.0)
2629
bigdecimal (3.1.8)
2730
claide (1.1.0)
2831
cocoapods (1.15.2)
@@ -80,6 +83,7 @@ GEM
8083
logger (1.6.1)
8184
minitest (5.25.1)
8285
molinillo (0.8.0)
86+
mutex_m (0.2.0)
8387
nanaimo (0.3.0)
8488
nap (1.1.0)
8589
netrc (0.11.0)

‎MacOSExample/macos/Podfile.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ PODS:
11661166
- React-utils (= 0.74.6)
11671167
- RNCAsyncStorage (1.24.0):
11681168
- React-Core
1169-
- RNGestureHandler (2.21.1):
1169+
- RNGestureHandler (2.21.2):
11701170
- DoubleConversion
11711171
- glog
11721172
- hermes-engine
@@ -1443,10 +1443,10 @@ EXTERNAL SOURCES:
14431443

14441444
SPEC CHECKSUMS:
14451445
boost: 0686b6af8cbd638c784fea5afb789be66699823c
1446-
DoubleConversion: acaf5db79676d2e9119015819153f0f99191de12
1446+
DoubleConversion: 5b92c4507c560bb62e7aa1acdf2785ea3ff08b3b
14471447
FBLazyVector: 8f41053475f558b29633b434bd62929813a38560
14481448
fmt: 03574da4b7ba40de39da59677ca66610ce8c4a02
1449-
glog: 6df0a3d6e2750a50609471fd1a01fd2948d405b5
1449+
glog: ba31c1afa7dcf1915a109861bccdb4421be6175b
14501450
hermes-engine: 2102c92e54a031a270fd1fe84169ec8a0901b7bd
14511451
RCT-Folly: 2edbb9597acadc2312235c7ad6243d49852047a3
14521452
RCTDeprecation: 5f1d7e1f8ef6c53f0207e3ac0d0ca23575e8a6ab
@@ -1496,11 +1496,11 @@ SPEC CHECKSUMS:
14961496
React-utils: d1f30e28b14bea6aa6b009be03ab502bbf2cf5c6
14971497
ReactCommon: 68cae4af53cf2d34e6a26c0099f434f170495dd1
14981498
RNCAsyncStorage: ec53e44dc3e75b44aa2a9f37618a49c3bc080a7a
1499-
RNGestureHandler: b7a0ffadce234020252d803904e7b32405945e27
1499+
RNGestureHandler: 280c8940cbc21ce8c189ddb4b32e2046c49f858f
15001500
RNReanimated: 45553a3ae29a75a76269595f8554d07d4090e392
15011501
RNSVG: 4590aa95758149fa27c5c83e54a6a466349a1688
15021502
SocketRocket: f6c6249082c011e6de2de60ed641ef8bbe0cfac9
1503-
Yoga: 2b5a8ace4c52fd28c52de828b9a66aede21c3a9c
1503+
Yoga: e0cc115eebe05a9f8da381a8de541b189f89f682
15041504

15051505
PODFILE CHECKSUM: 3d6bcfcb4beca113bbf03f2652ec9272037c8111
15061506

‎MacOSExample/yarn.lock

+1-13
Original file line numberDiff line numberDiff line change
@@ -1427,13 +1427,6 @@
14271427
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
14281428
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
14291429

1430-
"@egjs/hammerjs@^2.0.17":
1431-
version "2.0.17"
1432-
resolved "https://registry.yarnpkg.com/@egjs/hammerjs/-/hammerjs-2.0.17.tgz#5dc02af75a6a06e4c2db0202cae38c9263895124"
1433-
integrity sha512-XQsZgjm2EcVUiZQf11UBJQfmZeEmOW8DpI1gsFeln6w0ae0ii4dMQEQ0kjl6DspdWX1aGY1/loyXnP0JS06e/A==
1434-
dependencies:
1435-
"@types/hammerjs" "^2.0.36"
1436-
14371430
"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
14381431
version "4.4.0"
14391432
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59"
@@ -2330,11 +2323,6 @@
23302323
dependencies:
23312324
"@types/node" "*"
23322325

2333-
"@types/hammerjs@^2.0.36":
2334-
version "2.0.43"
2335-
resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.43.tgz#8660dd1e0e5fd979395e2f999e670cdb9484d1e9"
2336-
integrity sha512-wqxfwHk83RS7+6OpytGdo5wqkqtvx+bGaIs1Rwm5NrtQHUfL4OgWs/5p0OipmjmT+fexePh37Ek+mqIpdNjQKA==
2337-
23382326
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1":
23392327
version "2.0.5"
23402328
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz#fdfdd69fa16d530047d9963635bd77c71a08c068"
@@ -6273,7 +6261,7 @@ prompts@^2.0.1, prompts@^2.4.2:
62736261
kleur "^3.0.3"
62746262
sisteransi "^1.0.5"
62756263

6276-
prop-types@^15.7.2, prop-types@^15.8.1:
6264+
prop-types@^15.8.1:
62776265
version "15.8.1"
62786266
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
62796267
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==

‎android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def shouldUseCommonInterfaceFromReanimated() {
6969
def json = new JsonSlurper().parseText(inputFile.text)
7070
def reanimatedVersion = json.version as String
7171
def (major, minor, patch) = reanimatedVersion.tokenize('.')
72-
return (Integer.parseInt(major) == 2 && Integer.parseInt(minor) >= 3) || Integer.parseInt(major) == 3
72+
return (Integer.parseInt(major) == 2 && Integer.parseInt(minor) >= 3) || Integer.parseInt(major) >= 3
7373
} else {
7474
return false
7575
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
---
2+
id: reanimated-drawer-layout
3+
title: Reanimated Drawer Layout
4+
sidebar_label: Reanimated Drawer Layout
5+
---
6+
7+
import useBaseUrl from '@docusaurus/useBaseUrl';
8+
9+
Cross-platform replacement for the React Native's [DrawerLayoutAndroid](http://reactnative.dev/docs/drawerlayoutandroid.html) component.
10+
For detailed usage of standard parameters, please refer to the [React Native docs](http://reactnative.dev/docs/drawerlayoutandroid.html).
11+
12+
### Usage:
13+
14+
To use it, import it in the following way:
15+
16+
```js
17+
import ReanimatedDrawerLayout from 'react-native-gesture-handler/ReanimatedDrawerLayout';
18+
```
19+
20+
## Properties:
21+
22+
### `drawerType`
23+
24+
specifies the way the drawer will be displayed.
25+
Accepts values of the `DrawerPosition` enum. Defaults to `FRONT`.
26+
27+
- `FRONT` the drawer will be displayed above the content view.
28+
- `BACK` the drawer will be displayed below the content view, revealed by sliding away the content view.
29+
- `SLIDE` the drawer will appear attached to the content view, opening it slides both the drawer and the content view.
30+
31+
| `FRONT` | `BACK` | `SLIDE` |
32+
| ----------------------------------------------------- | ---------------------------------------------------- | ----------------------------------------------------- |
33+
| <img src={useBaseUrl('gifs/new-drawer-front.gif')} /> | <img src={useBaseUrl('gifs/new-drawer-back.gif')} /> | <img src={useBaseUrl('gifs/new-drawer-slide.gif')} /> |
34+
35+
### `edgeWidth`
36+
37+
width of the invisible, draggable area on the edge of the content view, which can be dragged to open the drawer.
38+
39+
### `hideStatusBar`
40+
41+
a boolean value. When set to `true`, drawer component will use [StatusBar API](http://reactnative.dev/docs/statusbar.html) to hide the OS status bar when the drawer is dragged or idle in the `open` position.
42+
43+
### `statusBarAnimation`
44+
45+
a string with possible values: `slide`, `none` or `fade`. Defaults to `slide`.
46+
May be used in combination with `hideStatusBar` to select the animation used for hiding the status bar.
47+
See [StatusBar API](http://reactnative.dev/docs/statusbar.html#statusbaranimation) docs.
48+
49+
### `overlayColor`
50+
51+
color of the background overlay on top of the content window when the drawer is `open`.
52+
This color's opacity animates from 0% to 100% as the drawer transitions from closed to open. Defaults to `rgba(0, 0, 0, 0.7)`.
53+
54+
### `renderNavigationView`
55+
56+
a renderer function for the drawer component, provided with a `progress` parameter.
57+
58+
- `progress` - `SharedValue` that indicates the progress of drawer opening/closing animation.
59+
- equals `0` when the `drawer` is closed and `1` when the `drawer` is opened
60+
- can be used by the `drawer` component to animated its children while the `drawer` is opening or closing
61+
62+
### `onDrawerClose`
63+
64+
a function which is called when the drawer has been closed.
65+
66+
### `onDrawerOpen`
67+
68+
a function which is called when the drawer has been opened.
69+
70+
### `onDrawerSlide`
71+
72+
a function which is called when drawer is moving or animating, provided with a `progress` parameter.
73+
74+
- `progress` - `SharedValue` that indicates the progress of drawer opening/closing animation.
75+
- equals `0` when the `drawer` is closed and `1` when the `drawer` is opened
76+
- can be used by the `drawer` component to animated its children while the `drawer` is opening or closing
77+
78+
### `onDrawerStateChanged`
79+
80+
a function which is called when the status of the drawer changes. It takes two arguments:
81+
82+
- `newState` - interaction state of the drawer. It can be one of the following:
83+
- `DrawerState.IDLE`
84+
- `DrawerState.DRAGGING`
85+
- `DrawerState.SETTLING`
86+
- `drawerWillShow` - `true` when `drawer` started animating to `open` position, `false` otherwise.
87+
88+
### `enableTrackpadTwoFingerGesture` (iOS only)
89+
90+
enables two-finger gestures on supported devices, for example iPads with trackpads.
91+
If not enabled, the gesture will require click + drag, with `enableTrackpadTwoFingerGesture` swiping with two fingers will also trigger the gesture.
92+
93+
### `children`
94+
95+
either a component that's rendered in the content view or a function.
96+
If `children` is a function, it is provided with a `progress` parameter.
97+
98+
- `progress` - `SharedValue` that indicates the progress of drawer opening/closing animation.
99+
- equals `0` when the `drawer` is closed and `1` when the `drawer` is opened
100+
- can be used by the `drawer` component to animated its children while the `drawer` is opening or closing
101+
102+
### `mouseButton(value: MouseButton)` (Web & Android only)
103+
104+
allows users to choose which mouse button should handler respond to.
105+
The enum `MouseButton` consists of the following predefined fields:
106+
107+
- `LEFT`
108+
- `RIGHT`
109+
- `MIDDLE`
110+
- `BUTTON_4`
111+
- `BUTTON_5`
112+
- `ALL`
113+
114+
Arguments can be combined using `|` operator, e.g. `mouseButton(MouseButton.LEFT | MouseButton.RIGHT)`. Defaults to `MouseButton.LEFT`.
115+
116+
### `enableContextMenu(value: boolean)` (Web only)
117+
118+
specifies whether context menu should be enabled after clicking on underlying view with right mouse button. Defaults to `false`.
119+
120+
## Methods
121+
122+
### `openDrawer(options)`
123+
124+
`openDrawer` accepts an optional `options` parameter, which is an object with the following optional properties:
125+
126+
- `initialVelocity` - the initial velocity of the object attached to the spring. Defaults to `0`.
127+
- `animationSpeed` - controls speed of the animation. Defaults to `1`.
128+
129+
### `closeDrawer(options)`
130+
131+
`closeDrawer` accepts an optional `options` parameter, which is an object with the following optional properties:
132+
133+
- `initialVelocity` - initial velocity of the object attached to the spring. Defaults to `0`.
134+
- `animationSpeed` - controls speed of the animation. Defaults to `1`.
135+
136+
## Example:
137+
138+
See the [reanimated drawer layout example](https://github.com/software-mansion/react-native-gesture-handler/blob/main/example/src/release_tests/reanimatedDrawerLayout/index.tsx) from GestureHandler example app.
139+
140+
```js
141+
import React, { useRef } from 'react';
142+
import { StyleSheet, Text, View } from 'react-native';
143+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
144+
145+
import ReanimatedDrawerLayout, {
146+
DrawerType,
147+
DrawerPosition,
148+
DrawerLayoutMethods,
149+
} from 'react-native-gesture-handler/ReanimatedDrawerLayout';
150+
151+
const DrawerPage = () => {
152+
return (
153+
<View style={styles.drawerContainer}>
154+
<Text>Lorem ipsum</Text>
155+
</View>
156+
);
157+
};
158+
159+
export default function ReanimatedDrawerExample() {
160+
const drawerRef = useRef < DrawerLayoutMethods > null;
161+
const tapGesture = Gesture.Tap()
162+
.runOnJS(true)
163+
.onStart(() => drawerRef.current?.openDrawer());
164+
165+
return (
166+
<ReanimatedDrawerLayout
167+
ref={drawerRef}
168+
renderNavigationView={() => <DrawerPage />}
169+
drawerPosition={DrawerPosition.LEFT}
170+
drawerType={DrawerType.FRONT}>
171+
<View style={styles.innerContainer}>
172+
<GestureDetector gesture={tapGesture}>
173+
<View style={styles.box}>
174+
<Text>Open drawer</Text>
175+
</View>
176+
</GestureDetector>
177+
</View>
178+
</ReanimatedDrawerLayout>
179+
);
180+
}
181+
182+
const styles = StyleSheet.create({
183+
drawerContainer: {
184+
flex: 1,
185+
justifyContent: 'center',
186+
alignItems: 'center',
187+
backgroundColor: 'pink',
188+
},
189+
innerContainer: {
190+
flex: 1,
191+
backgroundColor: 'white',
192+
alignItems: 'center',
193+
justifyContent: 'center',
194+
gap: 20,
195+
},
196+
box: {
197+
padding: 20,
198+
backgroundColor: 'pink',
199+
},
200+
});
201+
```

0 commit comments

Comments
 (0)
Please sign in to comment.