Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): track actual scroll interception before redispatch

DavidShen9ba95f3225c7
diff --git a/dependency-patches/[email protected] b/dependency-patches/[email protected]
index eca6322f17..f84a631d4b 100644
--- a/dependency-patches/[email protected]
+++ b/dependency-patches/[email protected]
@@ -1,26 +1,46 @@
diff --git a/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt b/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt
-index 83292244551410154a4efa0e243cc906dd13a30f..8159793328699b58a3100758f992fcd0305e56b2 100644
--- a/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt
+++ b/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt
-@@ -335,7 +335,23 @@ class NativeViewGestureHandler : GestureHandler() {
+@@ -125,12 +125,15 @@
+ } else if (state == STATE_UNDETERMINED || state == STATE_BEGAN) {
+ when {
+ shouldActivateOnStart -> {
+- tryIntercept(view, event)
++ if (tryIntercept(view, event)) {
++ (hook as? ScrollViewHook)?.onIntercept()
++ }
+ hook.sendTouchEvent(view, event)
+ activate()
+ }
+
+ tryIntercept(view, event) -> {
++ (hook as? ScrollViewHook)?.onIntercept()
+ hook.sendTouchEvent(view, event)
+ activate()
+ }
+@@ -335,7 +338,27 @@
}
private class ScrollViewHook : NativeViewGestureHandlerHook {
-+ private var dispatchingInterceptedStream = false
++ private var hasInterceptedTouchStream = false
+
override fun shouldCancelRootViewGestureHandlerIfNecessary() = true
+
++ fun onIntercept() {
++ hasInterceptedTouchStream = true
++ }
++
+ override fun sendTouchEvent(view: View?, event: MotionEvent): Boolean? {
-+ val terminal = event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL
-+ // Before activation, UP/CANCEL still belong to the normal root dispatch.
-+ // Redispatching them here interrupts selectable text's native action mode.
-+ if (!dispatchingInterceptedStream && terminal) return view?.onTouchEvent(event)
++ // Early/forced activation does not imply that the ScrollView intercepted.
++ // Keep its original delivery path until onInterceptTouchEvent returns true.
++ if (!hasInterceptedTouchStream) return view?.onTouchEvent(event)
+
+ // Interception bypasses root dispatch. Let the ScrollView cancel its child
+ // touch target, or text can run a pending long-press after UP (Cindy #6219).
-+ dispatchingInterceptedStream = true
+ val handled = view?.dispatchTouchEvent(event)
-+ if (terminal) dispatchingInterceptedStream = false
++ if (event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) {
++ hasInterceptedTouchStream = false
++ }
+ return handled
+ }
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1496623988..a2ca532108 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -35,7 +35,7 @@ patchedDependencies:
hash: 272e3ded46880ee2f9eaff39327b8465de6df4072271de03caf73950e6e57822
path: dependency-patches/harmonyos-sans-sc-webfont-splitted.patch
- hash: 15837ee0682cd5d6df449cdfc1348d9742ae83c56f9e3cb6d163bff67dfcc818
+ hash: a96d1b54b92694aef8a0b6b70c61978aac2cb4e6fc5c9c32dddb48d669877666
path: dependency-patches/[email protected]
hash: a43177abd7b38a283598e880a738eab3f69580e3c5dfea51dc2572570fafc7b1
@@ -752,7 +752,7 @@ importers:
version: 0.2.2(patch_hash=53be555646735a171c1624f074ef30e5ca897a7b8893724bc2d0d51682f769d8)([email protected])([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
expo-router:
specifier: ^57.0.17
- version: 57.0.17(patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(bda5a67c5d62adabeb58a0e0d4227159)
+ version: 57.0.17(patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(6d7b391932985e19a4a7f26e0f48fd04)
expo-secure-store:
specifier: ^57.0.2
version: 57.0.2([email protected])
@@ -797,7 +797,7 @@ importers:
version: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])
react-native-gesture-handler:
specifier: 2.32.0
- version: 2.32.0(patch_hash=15837ee0682cd5d6df449cdfc1348d9742ae83c56f9e3cb6d163bff67dfcc818)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
+ version: 2.32.0(patch_hash=a96d1b54b92694aef8a0b6b70c61978aac2cb4e6fc5c9c32dddb48d669877666)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
react-native-reanimated:
specifier: 4.5.1
@@ -13139,7 +13139,7 @@ snapshots:
ws: 8.21.1
zod: 4.3.6
optionalDependencies:
- expo-router: 57.0.17(patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(bda5a67c5d62adabeb58a0e0d4227159)
+ expo-router: 57.0.17(patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(6d7b391932985e19a4a7f26e0f48fd04)
react-native: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])
transitivePeerDependencies:
- '@expo/dom-webview'
@@ -13424,7 +13424,7 @@ snapshots:
react: 19.2.3
optionalDependencies:
- expo-router: 57.0.17(patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(bda5a67c5d62adabeb58a0e0d4227159)
+ expo-router: 57.0.17(patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(6d7b391932985e19a4a7f26e0f48fd04)
react-dom: 19.2.3([email protected])
transitivePeerDependencies:
- supports-color
@@ -18031,7 +18031,7 @@ snapshots:
react: 19.2.3
react-native: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])
- [email protected](patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(bda5a67c5d62adabeb58a0e0d4227159):
+ [email protected](patch_hash=47c33e2e770bd4fe9549dc8651c3c1326603ef78213b0539ba421823ac1804cc)(6d7b391932985e19a4a7f26e0f48fd04):
dependencies:
@@ -18058,7 +18058,7 @@ snapshots:
react-fast-compare: 3.2.2
react-is: 19.2.7
react-native: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])
react-native-safe-area-context: 5.7.0([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
react-native-screens: 4.26.2(patch_hash=a43177abd7b38a283598e880a738eab3f69580e3c5dfea51dc2572570fafc7b1)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
server-only: 0.0.1
@@ -18068,7 +18068,7 @@ snapshots:
optionalDependencies:
react-dom: 19.2.3([email protected])
- react-native-gesture-handler: 2.32.0(patch_hash=15837ee0682cd5d6df449cdfc1348d9742ae83c56f9e3cb6d163bff67dfcc818)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
+ react-native-gesture-handler: 2.32.0(patch_hash=a96d1b54b92694aef8a0b6b70c61978aac2cb4e6fc5c9c32dddb48d669877666)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
transitivePeerDependencies:
@@ -21216,16 +21216,16 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
color: 4.2.3
react: 19.2.3
react-native: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])
- react-native-gesture-handler: 2.32.0(patch_hash=15837ee0682cd5d6df449cdfc1348d9742ae83c56f9e3cb6d163bff67dfcc818)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
+ react-native-gesture-handler: 2.32.0(patch_hash=a96d1b54b92694aef8a0b6b70c61978aac2cb4e6fc5c9c32dddb48d669877666)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
use-latest-callback: 0.2.6([email protected])
- [email protected](patch_hash=15837ee0682cd5d6df449cdfc1348d9742ae83c56f9e3cb6d163bff67dfcc818)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected]):
+ [email protected](patch_hash=a96d1b54b92694aef8a0b6b70c61978aac2cb4e6fc5c9c32dddb48d669877666)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected]):
dependencies:
'@egjs/hammerjs': 2.0.17
'@types/react-test-renderer': 19.1.0