Skip to content

Commit 9aa72ba

Browse files
committed
Merge branch 'next' into @latekvo/remove-deprecated-components
2 parents b9cdf18 + fb3110f commit 9aa72ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2798
-3699
lines changed

FabricExample/ios/Podfile.lock

Lines changed: 4 additions & 4 deletions
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

Lines changed: 1 addition & 13 deletions
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

Lines changed: 7 additions & 3 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 1 addition & 13 deletions
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

Lines changed: 1 addition & 1 deletion
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
}

android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.swmansion.gesturehandler
22

3-
import com.facebook.react.TurboReactPackage
3+
import com.facebook.react.BaseReactPackage
44
import com.facebook.react.ViewManagerOnDemandReactPackage
55
import com.facebook.react.bridge.ModuleSpec
66
import com.facebook.react.bridge.NativeModule
@@ -19,7 +19,7 @@ import com.swmansion.gesturehandler.react.RNGestureHandlerRootViewManager
1919
RNGestureHandlerModule::class
2020
]
2121
)
22-
class RNGestureHandlerPackage : TurboReactPackage(), ViewManagerOnDemandReactPackage {
22+
class RNGestureHandlerPackage : BaseReactPackage(), ViewManagerOnDemandReactPackage {
2323
private val viewManagers: Map<String, ModuleSpec> by lazy {
2424
mapOf(
2525
RNGestureHandlerRootViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec {
@@ -71,7 +71,6 @@ class RNGestureHandlerPackage : TurboReactPackage(), ViewManagerOnDemandReactPac
7171
RNGestureHandlerModule::class.java.name,
7272
reactModule.canOverrideExistingModule,
7373
reactModule.needsEagerInit,
74-
true, // Has constants is hardcoded to return true, so replacing it with `true` changes nothing.
7574
reactModule.isCxxModule,
7675
true
7776
)

android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import android.widget.ScrollView
99
import com.facebook.react.views.scroll.ReactScrollView
1010
import com.facebook.react.views.swiperefresh.ReactSwipeRefreshLayout
1111
import com.facebook.react.views.textinput.ReactEditText
12+
import com.facebook.react.views.view.ReactViewGroup
1213
import com.swmansion.gesturehandler.react.RNGestureHandlerButtonViewManager
1314
import com.swmansion.gesturehandler.react.isScreenReaderOn
1415

@@ -79,6 +80,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
7980
is ReactEditText -> this.hook = EditTextHook(this, view)
8081
is ReactSwipeRefreshLayout -> this.hook = SwipeRefreshLayoutHook(this, view)
8182
is ReactScrollView -> this.hook = ScrollViewHook()
83+
is ReactViewGroup -> this.hook = ReactViewGroupHook()
8284
}
8385
}
8486

@@ -99,7 +101,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
99101
if (state == STATE_UNDETERMINED && !hook.canBegin(event)) {
100102
cancel()
101103
} else {
102-
view.onTouchEvent(event)
104+
hook.sendTouchEvent(view, event)
103105
if ((state == STATE_UNDETERMINED || state == STATE_BEGAN) && view.isPressed) {
104106
activate()
105107
}
@@ -116,12 +118,12 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
116118
when {
117119
shouldActivateOnStart -> {
118120
tryIntercept(view, event)
119-
view.onTouchEvent(event)
121+
hook.sendTouchEvent(view, event)
120122
activate()
121123
}
122124

123125
tryIntercept(view, event) -> {
124-
view.onTouchEvent(event)
126+
hook.sendTouchEvent(view, event)
125127
activate()
126128
}
127129

@@ -136,7 +138,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
136138
}
137139
}
138140
} else if (state == STATE_ACTIVE) {
139-
view.onTouchEvent(event)
141+
hook.sendTouchEvent(view, event)
140142
}
141143
}
142144

@@ -145,7 +147,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
145147
val event = MotionEvent.obtain(time, time, MotionEvent.ACTION_CANCEL, 0f, 0f, 0).apply {
146148
action = MotionEvent.ACTION_CANCEL
147149
}
148-
view!!.onTouchEvent(event)
150+
hook.sendTouchEvent(view, event)
149151
event.recycle()
150152
}
151153

@@ -199,6 +201,11 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
199201
* by this one.
200202
*/
201203
fun shouldCancelRootViewGestureHandlerIfNecessary() = false
204+
205+
/**
206+
* Passes the event down to the underlying view using the correct method.
207+
*/
208+
fun sendTouchEvent(view: View?, event: MotionEvent) = view?.onTouchEvent(event)
202209
}
203210

204211
private class EditTextHook(
@@ -278,4 +285,12 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
278285
private class ScrollViewHook : NativeViewGestureHandlerHook {
279286
override fun shouldCancelRootViewGestureHandlerIfNecessary() = true
280287
}
288+
289+
private class ReactViewGroupHook : NativeViewGestureHandlerHook {
290+
// There are cases where a native component is wrapped with a `ReactViewGroup` (the component is rendered
291+
// inside a `<View />` component in JS). In such cases, calling `onTouchEvent` wouldn't work as those are
292+
// ignored by the wrapper view. Instead `dispatchTouchEvent` can be used, which causes the view to dispatch
293+
// the event to its children.
294+
override fun sendTouchEvent(view: View?, event: MotionEvent) = view?.dispatchTouchEvent(event)
295+
}
281296
}

apple/RNGestureHandlerManager.mm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ @implementation RNGestureHandlerManager {
5151
RNGestureHandlerRegistry *_registry;
5252
NSHashTable<RNRootViewGestureRecognizer *> *_rootViewGestureRecognizers;
5353
NSMutableDictionary<NSNumber *, NSNumber *> *_attachRetryCounter;
54+
NSMutableSet *_droppedHandlers;
5455
#ifdef RCT_NEW_ARCH_ENABLED
5556
RCTModuleRegistry *_moduleRegistry;
5657
RCTViewRegistry *_viewRegistry;
@@ -90,6 +91,7 @@ - (void)initCommonProps
9091
_registry = [RNGestureHandlerRegistry new];
9192
_rootViewGestureRecognizers = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory];
9293
_attachRetryCounter = [[NSMutableDictionary alloc] init];
94+
_droppedHandlers = [NSMutableSet set];
9395
}
9496

9597
- (void)createGestureHandler:(NSString *)handlerName tag:(NSNumber *)handlerTag config:(NSDictionary *)config
@@ -168,7 +170,9 @@ - (void)attachGestureHandler:(nonnull NSNumber *)handlerTag
168170
[_attachRetryCounter setObject:counter forKey:viewTag];
169171

170172
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
171-
[self attachGestureHandler:handlerTag toViewWithTag:viewTag withActionType:actionType];
173+
if (![_droppedHandlers containsObject:handlerTag]) {
174+
[self attachGestureHandler:handlerTag toViewWithTag:viewTag withActionType:actionType];
175+
}
172176
});
173177
}
174178

@@ -205,6 +209,7 @@ - (void)updateGestureHandler:(NSNumber *)handlerTag config:(NSDictionary *)confi
205209
- (void)dropGestureHandler:(NSNumber *)handlerTag
206210
{
207211
[_registry dropHandlerWithTag:handlerTag];
212+
[_droppedHandlers addObject:handlerTag];
208213
}
209214

210215
- (void)dropAllGestureHandlers

0 commit comments

Comments
 (0)