Skip to content

Commit

Permalink
Merge branch 'next' into @latekvo/remove-deprecated-components
Browse files Browse the repository at this point in the history
  • Loading branch information
latekvo committed Dec 5, 2024
2 parents b9cdf18 + fb3110f commit 9aa72ba
Show file tree
Hide file tree
Showing 60 changed files with 2,798 additions and 3,699 deletions.
8 changes: 4 additions & 4 deletions FabricExample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ PODS:
- React-logger (= 0.76.0)
- React-perflogger (= 0.76.0)
- React-utils (= 0.76.0)
- RNGestureHandler (2.21.1):
- RNGestureHandler (2.21.2):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1743,7 +1743,7 @@ SPEC CHECKSUMS:
fmt: 10c6e61f4be25dc963c36bd73fc7b1705fe975be
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
hermes-engine: 9de51d2f67336348a6cd5b686330e436d1dbd522
RCT-Folly: bf5c0376ffe4dd2cf438dcf86db385df9fdce648
RCT-Folly: 84578c8756030547307e4572ab1947de1685c599
RCTDeprecation: 4c2c4a088b6f0ccfcbd53c9d5614b0238ad57909
RCTRequired: 2d8a683a7848bc0baf5883f0792c1ac43f6267b5
RCTTypeSafety: 23df4344c69c602e1c5a8053a93c633af1bee825
Expand Down Expand Up @@ -1799,9 +1799,9 @@ SPEC CHECKSUMS:
React-utils: e74516d5b9483c5530ec61e249e28b88729321d2
ReactCodegen: ff7512e124e3dc1363a4930a209d033354d2042a
ReactCommon: cde69a75746e8d7131f61c27155ee9dc42117003
RNGestureHandler: 39ce07f10bbd98e5810ee79780ed3d6c02fafeb2
RNGestureHandler: a1d7f6a6b72f4f57127df353cbe06955b6354fd7
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: f8ec45ce98bba1bc93dd28f2ee37215180e6d2b6
Yoga: 1d66db49f38fd9e576a1d7c3b081e46ab4c28b9e

PODFILE CHECKSUM: 0789d64718cebced7436c418e1f61d0aa9d54889

Expand Down
14 changes: 1 addition & 13 deletions FabricExample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1128,13 +1128,6 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@egjs/hammerjs@^2.0.17":
version "2.0.17"
resolved "https://registry.yarnpkg.com/@egjs/hammerjs/-/hammerjs-2.0.17.tgz#5dc02af75a6a06e4c2db0202cae38c9263895124"
integrity sha512-XQsZgjm2EcVUiZQf11UBJQfmZeEmOW8DpI1gsFeln6w0ae0ii4dMQEQ0kjl6DspdWX1aGY1/loyXnP0JS06e/A==
dependencies:
"@types/hammerjs" "^2.0.36"

"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
version "4.4.0"
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59"
Expand Down Expand Up @@ -1902,11 +1895,6 @@
dependencies:
"@types/node" "*"

"@types/hammerjs@^2.0.36":
version "2.0.45"
resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.45.tgz#ffa764bb68a66c08db6efb9c816eb7be850577b1"
integrity sha512-qkcUlZmX6c4J8q45taBKTL3p+LbITgyx7qhlPYOdOHZB7B31K0mXbP5YA7i7SgDeEGuI9MnumiKPEMrxg8j3KQ==

"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1":
version "2.0.6"
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7"
Expand Down Expand Up @@ -5630,7 +5618,7 @@ prompts@^2.0.1, prompts@^2.4.2:
kleur "^3.0.3"
sisteransi "^1.0.5"

prop-types@^15.7.2, prop-types@^15.8.1:
prop-types@^15.8.1:
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
Expand Down
10 changes: 7 additions & 3 deletions MacOSExample/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@ GEM
base64
nkf
rexml
activesupport (7.2.1)
activesupport (7.1.5)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
tzinfo (~> 2.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.8)
claide (1.1.0)
cocoapods (1.15.2)
Expand Down Expand Up @@ -80,6 +83,7 @@ GEM
logger (1.6.1)
minitest (5.25.1)
molinillo (0.8.0)
mutex_m (0.2.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
Expand Down
10 changes: 5 additions & 5 deletions MacOSExample/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ PODS:
- React-utils (= 0.74.6)
- RNCAsyncStorage (1.24.0):
- React-Core
- RNGestureHandler (2.21.1):
- RNGestureHandler (2.21.2):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1443,10 +1443,10 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: 0686b6af8cbd638c784fea5afb789be66699823c
DoubleConversion: acaf5db79676d2e9119015819153f0f99191de12
DoubleConversion: 5b92c4507c560bb62e7aa1acdf2785ea3ff08b3b
FBLazyVector: 8f41053475f558b29633b434bd62929813a38560
fmt: 03574da4b7ba40de39da59677ca66610ce8c4a02
glog: 6df0a3d6e2750a50609471fd1a01fd2948d405b5
glog: ba31c1afa7dcf1915a109861bccdb4421be6175b
hermes-engine: 2102c92e54a031a270fd1fe84169ec8a0901b7bd
RCT-Folly: 2edbb9597acadc2312235c7ad6243d49852047a3
RCTDeprecation: 5f1d7e1f8ef6c53f0207e3ac0d0ca23575e8a6ab
Expand Down Expand Up @@ -1496,11 +1496,11 @@ SPEC CHECKSUMS:
React-utils: d1f30e28b14bea6aa6b009be03ab502bbf2cf5c6
ReactCommon: 68cae4af53cf2d34e6a26c0099f434f170495dd1
RNCAsyncStorage: ec53e44dc3e75b44aa2a9f37618a49c3bc080a7a
RNGestureHandler: b7a0ffadce234020252d803904e7b32405945e27
RNGestureHandler: 280c8940cbc21ce8c189ddb4b32e2046c49f858f
RNReanimated: 45553a3ae29a75a76269595f8554d07d4090e392
RNSVG: 4590aa95758149fa27c5c83e54a6a466349a1688
SocketRocket: f6c6249082c011e6de2de60ed641ef8bbe0cfac9
Yoga: 2b5a8ace4c52fd28c52de828b9a66aede21c3a9c
Yoga: e0cc115eebe05a9f8da381a8de541b189f89f682

PODFILE CHECKSUM: 3d6bcfcb4beca113bbf03f2652ec9272037c8111

Expand Down
14 changes: 1 addition & 13 deletions MacOSExample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1427,13 +1427,6 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@egjs/hammerjs@^2.0.17":
version "2.0.17"
resolved "https://registry.yarnpkg.com/@egjs/hammerjs/-/hammerjs-2.0.17.tgz#5dc02af75a6a06e4c2db0202cae38c9263895124"
integrity sha512-XQsZgjm2EcVUiZQf11UBJQfmZeEmOW8DpI1gsFeln6w0ae0ii4dMQEQ0kjl6DspdWX1aGY1/loyXnP0JS06e/A==
dependencies:
"@types/hammerjs" "^2.0.36"

"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
version "4.4.0"
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59"
Expand Down Expand Up @@ -2330,11 +2323,6 @@
dependencies:
"@types/node" "*"

"@types/hammerjs@^2.0.36":
version "2.0.43"
resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.43.tgz#8660dd1e0e5fd979395e2f999e670cdb9484d1e9"
integrity sha512-wqxfwHk83RS7+6OpytGdo5wqkqtvx+bGaIs1Rwm5NrtQHUfL4OgWs/5p0OipmjmT+fexePh37Ek+mqIpdNjQKA==

"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1":
version "2.0.5"
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz#fdfdd69fa16d530047d9963635bd77c71a08c068"
Expand Down Expand Up @@ -6273,7 +6261,7 @@ prompts@^2.0.1, prompts@^2.4.2:
kleur "^3.0.3"
sisteransi "^1.0.5"

prop-types@^15.7.2, prop-types@^15.8.1:
prop-types@^15.8.1:
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def shouldUseCommonInterfaceFromReanimated() {
def json = new JsonSlurper().parseText(inputFile.text)
def reanimatedVersion = json.version as String
def (major, minor, patch) = reanimatedVersion.tokenize('.')
return (Integer.parseInt(major) == 2 && Integer.parseInt(minor) >= 3) || Integer.parseInt(major) == 3
return (Integer.parseInt(major) == 2 && Integer.parseInt(minor) >= 3) || Integer.parseInt(major) >= 3
} else {
return false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.swmansion.gesturehandler

import com.facebook.react.TurboReactPackage
import com.facebook.react.BaseReactPackage
import com.facebook.react.ViewManagerOnDemandReactPackage
import com.facebook.react.bridge.ModuleSpec
import com.facebook.react.bridge.NativeModule
Expand All @@ -19,7 +19,7 @@ import com.swmansion.gesturehandler.react.RNGestureHandlerRootViewManager
RNGestureHandlerModule::class
]
)
class RNGestureHandlerPackage : TurboReactPackage(), ViewManagerOnDemandReactPackage {
class RNGestureHandlerPackage : BaseReactPackage(), ViewManagerOnDemandReactPackage {
private val viewManagers: Map<String, ModuleSpec> by lazy {
mapOf(
RNGestureHandlerRootViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec {
Expand Down Expand Up @@ -71,7 +71,6 @@ class RNGestureHandlerPackage : TurboReactPackage(), ViewManagerOnDemandReactPac
RNGestureHandlerModule::class.java.name,
reactModule.canOverrideExistingModule,
reactModule.needsEagerInit,
true, // Has constants is hardcoded to return true, so replacing it with `true` changes nothing.
reactModule.isCxxModule,
true
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.widget.ScrollView
import com.facebook.react.views.scroll.ReactScrollView
import com.facebook.react.views.swiperefresh.ReactSwipeRefreshLayout
import com.facebook.react.views.textinput.ReactEditText
import com.facebook.react.views.view.ReactViewGroup
import com.swmansion.gesturehandler.react.RNGestureHandlerButtonViewManager
import com.swmansion.gesturehandler.react.isScreenReaderOn

Expand Down Expand Up @@ -79,6 +80,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
is ReactEditText -> this.hook = EditTextHook(this, view)
is ReactSwipeRefreshLayout -> this.hook = SwipeRefreshLayoutHook(this, view)
is ReactScrollView -> this.hook = ScrollViewHook()
is ReactViewGroup -> this.hook = ReactViewGroupHook()
}
}

Expand All @@ -99,7 +101,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
if (state == STATE_UNDETERMINED && !hook.canBegin(event)) {
cancel()
} else {
view.onTouchEvent(event)
hook.sendTouchEvent(view, event)
if ((state == STATE_UNDETERMINED || state == STATE_BEGAN) && view.isPressed) {
activate()
}
Expand All @@ -116,12 +118,12 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
when {
shouldActivateOnStart -> {
tryIntercept(view, event)
view.onTouchEvent(event)
hook.sendTouchEvent(view, event)
activate()
}

tryIntercept(view, event) -> {
view.onTouchEvent(event)
hook.sendTouchEvent(view, event)
activate()
}

Expand All @@ -136,7 +138,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
}
}
} else if (state == STATE_ACTIVE) {
view.onTouchEvent(event)
hook.sendTouchEvent(view, event)
}
}

Expand All @@ -145,7 +147,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
val event = MotionEvent.obtain(time, time, MotionEvent.ACTION_CANCEL, 0f, 0f, 0).apply {
action = MotionEvent.ACTION_CANCEL
}
view!!.onTouchEvent(event)
hook.sendTouchEvent(view, event)
event.recycle()
}

Expand Down Expand Up @@ -199,6 +201,11 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
* by this one.
*/
fun shouldCancelRootViewGestureHandlerIfNecessary() = false

/**
* Passes the event down to the underlying view using the correct method.
*/
fun sendTouchEvent(view: View?, event: MotionEvent) = view?.onTouchEvent(event)
}

private class EditTextHook(
Expand Down Expand Up @@ -278,4 +285,12 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
private class ScrollViewHook : NativeViewGestureHandlerHook {
override fun shouldCancelRootViewGestureHandlerIfNecessary() = true
}

private class ReactViewGroupHook : NativeViewGestureHandlerHook {
// There are cases where a native component is wrapped with a `ReactViewGroup` (the component is rendered
// inside a `<View />` component in JS). In such cases, calling `onTouchEvent` wouldn't work as those are
// ignored by the wrapper view. Instead `dispatchTouchEvent` can be used, which causes the view to dispatch
// the event to its children.
override fun sendTouchEvent(view: View?, event: MotionEvent) = view?.dispatchTouchEvent(event)
}
}
7 changes: 6 additions & 1 deletion apple/RNGestureHandlerManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ @implementation RNGestureHandlerManager {
RNGestureHandlerRegistry *_registry;
NSHashTable<RNRootViewGestureRecognizer *> *_rootViewGestureRecognizers;
NSMutableDictionary<NSNumber *, NSNumber *> *_attachRetryCounter;
NSMutableSet *_droppedHandlers;
#ifdef RCT_NEW_ARCH_ENABLED
RCTModuleRegistry *_moduleRegistry;
RCTViewRegistry *_viewRegistry;
Expand Down Expand Up @@ -90,6 +91,7 @@ - (void)initCommonProps
_registry = [RNGestureHandlerRegistry new];
_rootViewGestureRecognizers = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory];
_attachRetryCounter = [[NSMutableDictionary alloc] init];
_droppedHandlers = [NSMutableSet set];
}

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

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[self attachGestureHandler:handlerTag toViewWithTag:viewTag withActionType:actionType];
if (![_droppedHandlers containsObject:handlerTag]) {
[self attachGestureHandler:handlerTag toViewWithTag:viewTag withActionType:actionType];
}
});
}

Expand Down Expand Up @@ -205,6 +209,7 @@ - (void)updateGestureHandler:(NSNumber *)handlerTag config:(NSDictionary *)confi
- (void)dropGestureHandler:(NSNumber *)handlerTag
{
[_registry dropHandlerWithTag:handlerTag];
[_droppedHandlers addObject:handlerTag];
}

- (void)dropAllGestureHandlers
Expand Down
Loading

0 comments on commit 9aa72ba

Please sign in to comment.