react-native-gesture-handler 2.8.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/RNGestureHandler.podspec +2 -2
- package/android/build.gradle +107 -65
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandler.kt +1 -1
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +2 -0
- package/android/src/main/java/com/swmansion/gesturehandler/core/NativeViewGestureHandler.kt +39 -0
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +9 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerEvent.kt +14 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +5 -1
- package/android/src/main/jni/CMakeLists.txt +10 -44
- package/android/src/main/jni/cpp-adapter.cpp +16 -13
- package/ios/Handlers/RNFlingHandler.m +39 -37
- package/ios/Handlers/RNForceTouchHandler.m +19 -17
- package/ios/Handlers/RNLongPressHandler.m +20 -22
- package/ios/Handlers/RNManualHandler.m +2 -3
- package/ios/Handlers/RNNativeViewHandler.mm +96 -92
- package/ios/Handlers/RNPanHandler.m +28 -32
- package/ios/Handlers/RNPinchHandler.m +9 -10
- package/ios/Handlers/RNRotationHandler.m +11 -14
- package/ios/Handlers/RNTapHandler.m +26 -26
- package/ios/RNGestureHandler.h +31 -24
- package/ios/RNGestureHandler.m +278 -273
- package/ios/RNGestureHandlerActionType.h +6 -4
- package/ios/RNGestureHandlerButton.m +11 -12
- package/ios/RNGestureHandlerButtonComponentView.h +2 -2
- package/ios/RNGestureHandlerButtonComponentView.mm +2 -2
- package/ios/RNGestureHandlerButtonManager.m +6 -5
- package/ios/RNGestureHandlerDirection.h +4 -4
- package/ios/RNGestureHandlerEvents.h +3 -4
- package/ios/RNGestureHandlerEvents.m +114 -119
- package/ios/RNGestureHandlerManager.h +1 -2
- package/ios/RNGestureHandlerManager.mm +9 -9
- package/ios/RNGestureHandlerModule.h +1 -2
- package/ios/RNGestureHandlerModule.mm +142 -138
- package/ios/RNGestureHandlerPointerTracker.h +1 -1
- package/ios/RNGestureHandlerPointerTracker.m +40 -37
- package/ios/RNGestureHandlerRegistry.h +3 -1
- package/ios/RNGestureHandlerRegistry.m +24 -22
- package/ios/RNGestureHandlerRootViewComponentView.mm +2 -2
- package/ios/RNGestureHandlerState.h +6 -6
- package/ios/RNGestureHandlerStateManager.h +1 -1
- package/ios/RNManualActivationRecognizer.m +9 -9
- package/ios/RNRootViewGestureRecognizer.m +39 -42
- package/lib/commonjs/EnableNewWebImplementation.js +35 -0
- package/lib/commonjs/EnableNewWebImplementation.js.map +1 -0
- package/lib/commonjs/GestureHandlerRootViewContext.js +15 -0
- package/lib/commonjs/GestureHandlerRootViewContext.js.map +1 -0
- package/lib/commonjs/RNGestureHandlerModule.macos.js +6 -6
- package/lib/commonjs/RNGestureHandlerModule.macos.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.web.js +6 -6
- package/lib/commonjs/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.windows.js +6 -6
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/GestureComponents.web.js +6 -5
- package/lib/commonjs/components/GestureComponents.web.js.map +1 -1
- package/lib/commonjs/components/GestureHandlerButton.js +3 -5
- package/lib/commonjs/components/GestureHandlerButton.js.map +1 -1
- package/lib/commonjs/{GestureHandlerRootView.android.js → components/GestureHandlerRootView.android.js} +8 -7
- package/lib/commonjs/components/GestureHandlerRootView.android.js.map +1 -0
- package/lib/commonjs/{GestureHandlerRootView.js → components/GestureHandlerRootView.js} +8 -2
- package/lib/commonjs/components/GestureHandlerRootView.js.map +1 -0
- package/lib/commonjs/{GestureHandlerRootView.web.js → components/GestureHandlerRootView.web.js} +7 -1
- package/lib/commonjs/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/commonjs/components/Swipeable.js +17 -3
- package/lib/commonjs/components/Swipeable.js.map +1 -1
- package/lib/commonjs/{gestureHandlerRootHOC.js → components/gestureHandlerRootHOC.js} +2 -1
- package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -0
- package/lib/commonjs/handlers/LongPressGestureHandler.js +3 -1
- package/lib/commonjs/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/TapGestureHandler.js +3 -1
- package/lib/commonjs/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/handlers/createHandler.js +21 -13
- package/lib/commonjs/handlers/createHandler.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +5 -4
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +89 -37
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/longPressGesture.js +1 -0
- package/lib/commonjs/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js +22 -19
- package/lib/commonjs/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/commonjs/handlers/gestures/tapGesture.js +1 -0
- package/lib/commonjs/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/commonjs/index.js +16 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils.js +0 -6
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +0 -5
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +3 -0
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +0 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/ManualGestureHandler.js +0 -5
- package/lib/commonjs/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js +0 -6
- package/lib/commonjs/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +2 -12
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PinchGestureHandler.js +0 -5
- package/lib/commonjs/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/RotationGestureHandler.js +0 -6
- package/lib/commonjs/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +0 -7
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/tools/CircularBuffer.js +59 -0
- package/lib/commonjs/web/tools/CircularBuffer.js.map +1 -0
- package/lib/commonjs/web/tools/LeastSquareSolver.js +204 -0
- package/lib/commonjs/web/tools/LeastSquareSolver.js.map +1 -0
- package/lib/commonjs/web/tools/PointerEventManager.js +27 -0
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerTracker.js +11 -7
- package/lib/commonjs/web/tools/PointerTracker.js.map +1 -1
- package/lib/commonjs/web/tools/VelocityTracker.js +111 -0
- package/lib/commonjs/web/tools/VelocityTracker.js.map +1 -0
- package/lib/commonjs/web_hammer/GestureHandler.js +1 -1
- package/lib/commonjs/web_hammer/GestureHandler.js.map +1 -1
- package/lib/module/EnableNewWebImplementation.js +22 -0
- package/lib/module/EnableNewWebImplementation.js.map +1 -0
- package/lib/module/GestureHandlerRootViewContext.js +3 -0
- package/lib/module/GestureHandlerRootViewContext.js.map +1 -0
- package/lib/module/RNGestureHandlerModule.macos.js +6 -6
- package/lib/module/RNGestureHandlerModule.macos.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.web.js +6 -6
- package/lib/module/RNGestureHandlerModule.web.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.windows.js +6 -6
- package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/GestureComponents.web.js +5 -6
- package/lib/module/components/GestureComponents.web.js.map +1 -1
- package/lib/module/components/GestureHandlerButton.js +1 -4
- package/lib/module/components/GestureHandlerButton.js.map +1 -1
- package/lib/module/components/GestureHandlerRootView.android.js +14 -0
- package/lib/module/components/GestureHandlerRootView.android.js.map +1 -0
- package/lib/module/{GestureHandlerRootView.js → components/GestureHandlerRootView.js} +5 -2
- package/lib/module/components/GestureHandlerRootView.js.map +1 -0
- package/lib/module/components/GestureHandlerRootView.web.js +9 -0
- package/lib/module/components/GestureHandlerRootView.web.js.map +1 -0
- package/lib/module/components/Swipeable.js +17 -3
- package/lib/module/components/Swipeable.js.map +1 -1
- package/lib/module/{gestureHandlerRootHOC.js → components/gestureHandlerRootHOC.js} +2 -1
- package/lib/module/components/gestureHandlerRootHOC.js.map +1 -0
- package/lib/module/handlers/LongPressGestureHandler.js +3 -1
- package/lib/module/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/handlers/TapGestureHandler.js +3 -1
- package/lib/module/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/handlers/createHandler.js +20 -13
- package/lib/module/handlers/createHandler.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js +5 -4
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector.js +89 -38
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/longPressGesture.js +1 -0
- package/lib/module/handlers/gestures/longPressGesture.js.map +1 -1
- package/lib/module/handlers/gestures/reanimatedWrapper.js +19 -16
- package/lib/module/handlers/gestures/reanimatedWrapper.js.map +1 -1
- package/lib/module/handlers/gestures/tapGesture.js +1 -0
- package/lib/module/handlers/gestures/tapGesture.js.map +1 -1
- package/lib/module/index.js +4 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils.js +0 -4
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/handlers/FlingGestureHandler.js +0 -5
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +3 -0
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js +0 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/ManualGestureHandler.js +0 -5
- package/lib/module/web/handlers/ManualGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/NativeViewGestureHandler.js +0 -6
- package/lib/module/web/handlers/NativeViewGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +2 -9
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PinchGestureHandler.js +0 -5
- package/lib/module/web/handlers/PinchGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/RotationGestureHandler.js +0 -6
- package/lib/module/web/handlers/RotationGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +0 -7
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/tools/CircularBuffer.js +50 -0
- package/lib/module/web/tools/CircularBuffer.js.map +1 -0
- package/lib/module/web/tools/LeastSquareSolver.js +195 -0
- package/lib/module/web/tools/LeastSquareSolver.js.map +1 -0
- package/lib/module/web/tools/PointerEventManager.js +27 -0
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/PointerTracker.js +8 -7
- package/lib/module/web/tools/PointerTracker.js.map +1 -1
- package/lib/module/web/tools/VelocityTracker.js +98 -0
- package/lib/module/web/tools/VelocityTracker.js.map +1 -0
- package/lib/module/web_hammer/GestureHandler.js +1 -1
- package/lib/module/web_hammer/GestureHandler.js.map +1 -1
- package/lib/typescript/EnableNewWebImplementation.d.ts +3 -0
- package/lib/typescript/GestureHandlerRootViewContext.d.ts +3 -0
- package/lib/typescript/components/DrawerLayout.d.ts +3 -1
- package/lib/typescript/components/GestureComponents.web.d.ts +1 -1
- package/lib/typescript/components/Swipeable.d.ts +14 -2
- package/lib/typescript/components/gestureHandlerRootHOC.d.ts +3 -0
- package/lib/typescript/index.d.ts +4 -4
- package/lib/typescript/{fabric → specs}/RNGestureHandlerButtonNativeComponent.d.ts +1 -1
- package/lib/typescript/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.d.ts +1 -1
- package/lib/typescript/utils.d.ts +0 -1
- package/lib/typescript/web/handlers/FlingGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/ManualGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/NativeViewGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/PanGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/PinchGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/RotationGestureHandler.d.ts +0 -1
- package/lib/typescript/web/handlers/TapGestureHandler.d.ts +0 -1
- package/lib/typescript/web/tools/CircularBuffer.d.ts +11 -0
- package/lib/typescript/web/tools/LeastSquareSolver.d.ts +12 -0
- package/lib/typescript/web/tools/PointerEventManager.d.ts +2 -0
- package/lib/typescript/web/tools/PointerTracker.d.ts +1 -0
- package/lib/typescript/web/tools/VelocityTracker.d.ts +13 -0
- package/package.json +6 -7
- package/src/EnableNewWebImplementation.ts +35 -0
- package/src/GestureHandlerRootViewContext.ts +3 -0
- package/src/RNGestureHandlerModule.macos.ts +6 -6
- package/src/RNGestureHandlerModule.web.ts +6 -6
- package/src/RNGestureHandlerModule.windows.ts +6 -6
- package/src/components/DrawerLayout.tsx +8 -4
- package/src/components/GestureComponents.web.tsx +5 -6
- package/src/components/GestureHandlerButton.tsx +2 -7
- package/src/components/GestureHandlerRootView.android.tsx +24 -0
- package/src/{GestureHandlerRootView.tsx → components/GestureHandlerRootView.tsx} +7 -2
- package/src/{GestureHandlerRootView.web.tsx → components/GestureHandlerRootView.web.tsx} +6 -1
- package/src/components/Swipeable.tsx +43 -12
- package/src/{gestureHandlerRootHOC.tsx → components/gestureHandlerRootHOC.tsx} +4 -1
- package/src/handlers/LongPressGestureHandler.ts +3 -1
- package/src/handlers/TapGestureHandler.ts +3 -1
- package/src/handlers/createHandler.tsx +20 -9
- package/src/handlers/gestureHandlerCommon.ts +5 -6
- package/src/handlers/gestures/GestureDetector.tsx +99 -36
- package/src/handlers/gestures/longPressGesture.ts +1 -0
- package/src/handlers/gestures/reanimatedWrapper.ts +21 -20
- package/src/handlers/gestures/tapGesture.ts +1 -0
- package/src/index.ts +7 -3
- package/src/utils.ts +0 -5
- package/src/web/handlers/FlingGestureHandler.ts +0 -5
- package/src/web/handlers/GestureHandler.ts +3 -0
- package/src/web/handlers/LongPressGestureHandler.ts +0 -1
- package/src/web/handlers/ManualGestureHandler.ts +0 -5
- package/src/web/handlers/NativeViewGestureHandler.ts +0 -6
- package/src/web/handlers/PanGestureHandler.ts +2 -9
- package/src/web/handlers/PinchGestureHandler.ts +0 -5
- package/src/web/handlers/RotationGestureHandler.ts +0 -7
- package/src/web/handlers/TapGestureHandler.ts +0 -7
- package/src/web/tools/CircularBuffer.ts +42 -0
- package/src/web/tools/LeastSquareSolver.ts +182 -0
- package/src/web/tools/PointerEventManager.ts +29 -0
- package/src/web/tools/PointerTracker.ts +7 -7
- package/src/web/tools/VelocityTracker.ts +98 -0
- package/src/web_hammer/GestureHandler.ts +1 -1
- package/lib/commonjs/EnableExperimentalWebImplementation.js +0 -31
- package/lib/commonjs/EnableExperimentalWebImplementation.js.map +0 -1
- package/lib/commonjs/GestureHandlerRootView.android.js.map +0 -1
- package/lib/commonjs/GestureHandlerRootView.js.map +0 -1
- package/lib/commonjs/GestureHandlerRootView.web.js.map +0 -1
- package/lib/commonjs/gestureHandlerRootHOC.js.map +0 -1
- package/lib/module/EnableExperimentalWebImplementation.js +0 -20
- package/lib/module/EnableExperimentalWebImplementation.js.map +0 -1
- package/lib/module/GestureHandlerRootView.android.js +0 -14
- package/lib/module/GestureHandlerRootView.android.js.map +0 -1
- package/lib/module/GestureHandlerRootView.js.map +0 -1
- package/lib/module/GestureHandlerRootView.web.js +0 -6
- package/lib/module/GestureHandlerRootView.web.js.map +0 -1
- package/lib/module/gestureHandlerRootHOC.js.map +0 -1
- package/lib/typescript/EnableExperimentalWebImplementation.d.ts +0 -2
- package/lib/typescript/gestureHandlerRootHOC.d.ts +0 -3
- package/src/EnableExperimentalWebImplementation.ts +0 -27
- package/src/GestureHandlerRootView.android.tsx +0 -24
- /package/lib/commonjs/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js +0 -0
- /package/lib/commonjs/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js.map +0 -0
- /package/lib/commonjs/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js +0 -0
- /package/lib/commonjs/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js.map +0 -0
- /package/lib/module/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js +0 -0
- /package/lib/module/{fabric → specs}/RNGestureHandlerButtonNativeComponent.js.map +0 -0
- /package/lib/module/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js +0 -0
- /package/lib/module/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.js.map +0 -0
- /package/lib/typescript/{GestureHandlerRootView.android.d.ts → components/GestureHandlerRootView.android.d.ts} +0 -0
- /package/lib/typescript/{GestureHandlerRootView.d.ts → components/GestureHandlerRootView.d.ts} +0 -0
- /package/lib/typescript/{GestureHandlerRootView.web.d.ts → components/GestureHandlerRootView.web.d.ts} +0 -0
- /package/src/{fabric → specs}/RNGestureHandlerButtonNativeComponent.ts +0 -0
- /package/src/{fabric → specs}/RNGestureHandlerRootViewNativeComponent.ts +0 -0
package/README.md
CHANGED
package/RNGestureHandler.podspec
CHANGED
|
@@ -2,7 +2,7 @@ require "json"
|
|
|
2
2
|
|
|
3
3
|
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
4
4
|
|
|
5
|
-
isUserApp = File.
|
|
5
|
+
isUserApp = File.exist?(File.join(__dir__, "..", "..", "node_modules", "react-native", "package.json"))
|
|
6
6
|
if isUserApp
|
|
7
7
|
libInstances = %x[find ../../ -name "package.json" | grep "/react-native-gesture-handler/package.json" | grep -v "/.yarn/"]
|
|
8
8
|
libInstancesArray = libInstances.split("\n")
|
|
@@ -39,7 +39,7 @@ Pod::Spec.new do |s|
|
|
|
39
39
|
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
|
|
40
40
|
}
|
|
41
41
|
s.platforms = { ios: '11.0', tvos: '11.0' }
|
|
42
|
-
s.compiler_flags = folly_compiler_flags + ' -
|
|
42
|
+
s.compiler_flags = folly_compiler_flags + ' -DRCT_NEW_ARCH_ENABLED'
|
|
43
43
|
|
|
44
44
|
s.dependency "React"
|
|
45
45
|
s.dependency "React-RCTFabric" # This is for fabric component
|
package/android/build.gradle
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import groovy.json.JsonSlurper
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import javax.inject.Inject
|
|
4
|
+
import java.nio.file.Files
|
|
3
5
|
|
|
4
6
|
buildscript {
|
|
5
7
|
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['RNGH_kotlinVersion']
|
|
@@ -27,25 +29,33 @@ def isNewArchitectureEnabled() {
|
|
|
27
29
|
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// Node's module resolution algorithm searches up to the root directory,
|
|
33
|
-
// after which the base path will be null
|
|
34
|
-
while (basePath) {
|
|
35
|
-
def candidatePath = Paths.get(basePath.toString(), "node_modules", packageName)
|
|
36
|
-
if (candidatePath.toFile().exists()) {
|
|
37
|
-
return candidatePath.toString()
|
|
38
|
-
}
|
|
39
|
-
basePath = basePath.getParent()
|
|
40
|
-
}
|
|
41
|
-
return null
|
|
32
|
+
def safeExtGet(prop, fallback) {
|
|
33
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
42
34
|
}
|
|
43
35
|
|
|
44
|
-
def
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
def resolveReactNativeDirectory() {
|
|
37
|
+
def reactNativeLocation = safeExtGet("REACT_NATIVE_NODE_MODULES_DIR", null)
|
|
38
|
+
if (reactNativeLocation != null) {
|
|
39
|
+
return file(reactNativeLocation)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// monorepo workaround
|
|
43
|
+
// react-native can be hoisted or in project's own node_modules
|
|
44
|
+
def reactNativeFromProjectNodeModules = file("${rootProject.projectDir}/../node_modules/react-native")
|
|
45
|
+
if (reactNativeFromProjectNodeModules.exists()) {
|
|
46
|
+
return reactNativeFromProjectNodeModules
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
def reactNativeFromNodeModulesWithReanimated = file("${projectDir}/../../react-native")
|
|
50
|
+
if (reactNativeFromNodeModulesWithReanimated.exists()) {
|
|
51
|
+
return reactNativeFromNodeModulesWithReanimated
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
throw new Exception(
|
|
55
|
+
"[react-native-gesture-handler] Unable to resolve react-native location in " +
|
|
56
|
+
"node_modules. You should add project extension property (in app/build.gradle) " +
|
|
57
|
+
"`REACT_NATIVE_NODE_MODULES_DIR` with path to react-native."
|
|
58
|
+
)
|
|
49
59
|
}
|
|
50
60
|
|
|
51
61
|
if (isNewArchitectureEnabled()) {
|
|
@@ -58,8 +68,12 @@ if (project == rootProject) {
|
|
|
58
68
|
apply from: "spotless.gradle"
|
|
59
69
|
}
|
|
60
70
|
|
|
61
|
-
def
|
|
62
|
-
|
|
71
|
+
def shouldAssertNoMultipleInstances() {
|
|
72
|
+
if (rootProject.hasProperty("disableMultipleInstancesCheck")) {
|
|
73
|
+
return rootProject.property("disableMultipleInstancesCheck") != "true"
|
|
74
|
+
} else {
|
|
75
|
+
return true
|
|
76
|
+
}
|
|
63
77
|
}
|
|
64
78
|
|
|
65
79
|
// Check whether Reanimated 2.3 or higher is installed alongside Gesture Handler
|
|
@@ -81,46 +95,83 @@ def reactNativeArchitectures() {
|
|
|
81
95
|
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
82
96
|
}
|
|
83
97
|
|
|
84
|
-
def
|
|
85
|
-
if (rootProject.hasProperty("disableMultipleInstancesCheck")) {
|
|
86
|
-
return rootProject.property("disableMultipleInstancesCheck") != "true"
|
|
87
|
-
} else {
|
|
88
|
-
return true
|
|
89
|
-
}
|
|
90
|
-
}
|
|
98
|
+
def REACT_NATIVE_DIR = resolveReactNativeDirectory()
|
|
91
99
|
|
|
92
|
-
def
|
|
93
|
-
|
|
94
|
-
include "node_modules/**/react-native-gesture-handler/package.json"
|
|
95
|
-
exclude "**/.yarn/**"
|
|
96
|
-
}.files
|
|
100
|
+
def reactProperties = new Properties()
|
|
101
|
+
file("$REACT_NATIVE_DIR/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
|
|
97
102
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
|
|
104
|
+
def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
abstract class NoMultipleInstancesAssertionTask extends DefaultTask {
|
|
108
|
+
@Inject abstract ObjectFactory getObjectFactory()
|
|
109
|
+
|
|
110
|
+
@Input abstract Property<File> getProjectDirFile()
|
|
111
|
+
@Input abstract Property<File> getRootDirFile()
|
|
112
|
+
@Input abstract Property<Boolean> getShouldCheck()
|
|
113
|
+
|
|
114
|
+
def findGestureHandlerInstancesForPath(String path) {
|
|
115
|
+
return objectFactory.fileTree().from(path)
|
|
116
|
+
.include("**/react-native-gesture-handler/package.json")
|
|
117
|
+
.exclude("**/.yarn/**")
|
|
118
|
+
.exclude({ Files.isSymbolicLink(it.getFile().toPath()) })
|
|
119
|
+
.findAll()
|
|
102
120
|
}
|
|
103
|
-
}
|
|
104
121
|
|
|
105
|
-
|
|
122
|
+
@TaskAction
|
|
123
|
+
def check() {
|
|
124
|
+
if (shouldCheck.get()) {
|
|
125
|
+
// Assert there are no multiple installations of Gesture Handler
|
|
126
|
+
Set<File> files
|
|
106
127
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
128
|
+
if (projectDirFile.get().parent.contains(rootDirFile.get().parent)) {
|
|
129
|
+
// standard app
|
|
130
|
+
files = findGestureHandlerInstancesForPath(rootDirFile.get().parent + "/node_modules")
|
|
131
|
+
} else {
|
|
132
|
+
// monorepo
|
|
133
|
+
files = findGestureHandlerInstancesForPath(rootDirFile.get().parent + "/node_modules")
|
|
134
|
+
files.addAll(
|
|
135
|
+
findGestureHandlerInstancesForPath(projectDirFile.get().parentFile.parent)
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (files.size() > 1) {
|
|
140
|
+
String parsedLocation = files.stream().map({
|
|
141
|
+
File file -> "- " + file.toString().replace("/package.json", "")
|
|
142
|
+
}).collect().join("\n")
|
|
143
|
+
String exceptionMessage = "\n[react-native-gesture-handler] Multiple versions of Gesture Handler " +
|
|
144
|
+
"were detected. Only one instance of react-native-gesture-handler can be installed in a " +
|
|
145
|
+
"project. You need to resolve the conflict manually. Check out the documentation: " +
|
|
146
|
+
"https://docs.swmansion.com/react-native-gesture-handler/docs/troubleshooting" +
|
|
147
|
+
"#multiple-instances-of-gesture-handler-were-detected \n\nConflict between: \n" +
|
|
148
|
+
parsedLocation + "\n"
|
|
149
|
+
throw new GradleException(exceptionMessage)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
111
152
|
}
|
|
112
153
|
}
|
|
113
154
|
|
|
114
|
-
tasks.
|
|
115
|
-
|
|
155
|
+
tasks.register('assertNoMultipleInstances', NoMultipleInstancesAssertionTask) {
|
|
156
|
+
shouldCheck = shouldAssertNoMultipleInstances()
|
|
157
|
+
rootDirFile = rootDir
|
|
158
|
+
projectDirFile = projectDir
|
|
116
159
|
}
|
|
117
160
|
|
|
161
|
+
tasks.preBuild {
|
|
162
|
+
dependsOn assertNoMultipleInstances
|
|
163
|
+
}
|
|
164
|
+
|
|
118
165
|
repositories {
|
|
119
166
|
mavenCentral()
|
|
120
167
|
}
|
|
121
168
|
|
|
122
169
|
android {
|
|
123
170
|
compileSdkVersion safeExtGet("compileSdkVersion", 28)
|
|
171
|
+
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
172
|
+
if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
|
|
173
|
+
namespace "com.swmansion.gesturehandler"
|
|
174
|
+
}
|
|
124
175
|
|
|
125
176
|
// Used to override the NDK path/version on internal CI or by allowing
|
|
126
177
|
// users to customize the NDK path/version from their root project (e.g. for M1 support)
|
|
@@ -131,17 +182,25 @@ android {
|
|
|
131
182
|
ndkVersion rootProject.ext.ndkVersion
|
|
132
183
|
}
|
|
133
184
|
|
|
185
|
+
if (REACT_NATIVE_MINOR_VERSION >= 71) {
|
|
186
|
+
buildFeatures {
|
|
187
|
+
prefab true
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
134
191
|
defaultConfig {
|
|
135
192
|
minSdkVersion safeExtGet('minSdkVersion', 16)
|
|
136
193
|
targetSdkVersion safeExtGet('targetSdkVersion', 28)
|
|
137
194
|
versionCode 1
|
|
138
195
|
versionName "1.0"
|
|
139
196
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
197
|
+
buildConfigField "int", "REACT_NATIVE_MINOR_VERSION", REACT_NATIVE_MINOR_VERSION.toString()
|
|
198
|
+
|
|
140
199
|
if (isNewArchitectureEnabled()) {
|
|
141
200
|
var appProject = rootProject.allprojects.find {it.plugins.hasPlugin('com.android.application')}
|
|
142
201
|
externalNativeBuild {
|
|
143
202
|
cmake {
|
|
144
|
-
cppFlags "-O2 -frtti -fexceptions -Wall -
|
|
203
|
+
cppFlags "-O2", "-frtti", "-fexceptions", "-Wall", "-Werror", "-std=c++17"
|
|
145
204
|
arguments "-DAPP_BUILD_DIR=${appProject.buildDir}",
|
|
146
205
|
"-DREACT_NATIVE_DIR=${REACT_NATIVE_DIR}",
|
|
147
206
|
"-DANDROID_STL=c++_shared"
|
|
@@ -198,10 +257,10 @@ def kotlin_version = safeExtGet('kotlinVersion', project.properties['RNGH_kotlin
|
|
|
198
257
|
|
|
199
258
|
dependencies {
|
|
200
259
|
//noinspection GradleDynamicVersion
|
|
201
|
-
if (
|
|
202
|
-
implementation
|
|
260
|
+
if (REACT_NATIVE_MINOR_VERSION >= 71) {
|
|
261
|
+
implementation "com.facebook.react:react-android" // version substituted by RNGP
|
|
203
262
|
} else {
|
|
204
|
-
implementation 'com.facebook.react:react-native:+'
|
|
263
|
+
implementation 'com.facebook.react:react-native:+' // from node_modules
|
|
205
264
|
}
|
|
206
265
|
|
|
207
266
|
if (shouldUseCommonInterfaceFromReanimated()) {
|
|
@@ -215,20 +274,3 @@ dependencies {
|
|
|
215
274
|
implementation "androidx.core:core-ktx:1.6.0"
|
|
216
275
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
217
276
|
}
|
|
218
|
-
|
|
219
|
-
if (isNewArchitectureEnabled()) {
|
|
220
|
-
// Resolves "LOCAL_SRC_FILES points to a missing file, Check that libfb.so exists or that its path is correct".
|
|
221
|
-
tasks.whenTaskAdded { task ->
|
|
222
|
-
if (task.name.contains("configureCMakeDebug")) {
|
|
223
|
-
rootProject.getTasksByName("packageReactNdkDebugLibs", true).forEach {
|
|
224
|
-
task.dependsOn(it)
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
// We want to add a dependency for both configureCMakeRelease and configureCMakeRelWithDebInfo
|
|
228
|
-
if (task.name.contains("configureCMakeRel")) {
|
|
229
|
-
rootProject.getTasksByName("packageReactNdkReleaseLibs", true).forEach {
|
|
230
|
-
task.dependsOn(it)
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
@@ -64,7 +64,7 @@ open class GestureHandler<ConcreteGestureHandlerT : GestureHandler<ConcreteGestu
|
|
|
64
64
|
private var shouldCancelWhenOutside = false
|
|
65
65
|
var numberOfPointers = 0
|
|
66
66
|
private set
|
|
67
|
-
|
|
67
|
+
protected var orchestrator: GestureHandlerOrchestrator? = null
|
|
68
68
|
private var onTouchEventListener: OnTouchEventListener? = null
|
|
69
69
|
private var interactionController: GestureHandlerInteractionController? = null
|
|
70
70
|
|
package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt
CHANGED
|
@@ -50,6 +50,8 @@ class GestureHandlerOrchestrator(
|
|
|
50
50
|
return true
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
fun getHandlersForView(view: View) = handlerRegistry.getHandlersForView(view)
|
|
54
|
+
|
|
53
55
|
private fun scheduleFinishedHandlersCleanup() {
|
|
54
56
|
if (isHandlingTouch || handlingChangeSemaphore != 0) {
|
|
55
57
|
finishedHandlersCleanupScheduled = true
|
|
@@ -5,6 +5,8 @@ import android.view.MotionEvent
|
|
|
5
5
|
import android.view.View
|
|
6
6
|
import android.view.ViewConfiguration
|
|
7
7
|
import android.view.ViewGroup
|
|
8
|
+
import android.widget.ScrollView
|
|
9
|
+
import com.facebook.react.views.swiperefresh.ReactSwipeRefreshLayout
|
|
8
10
|
import com.facebook.react.views.textinput.ReactEditText
|
|
9
11
|
|
|
10
12
|
class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
@@ -72,6 +74,7 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
|
72
74
|
when (val view = view) {
|
|
73
75
|
is NativeViewGestureHandlerHook -> this.hook = view
|
|
74
76
|
is ReactEditText -> this.hook = EditTextHook(this, view)
|
|
77
|
+
is ReactSwipeRefreshLayout -> this.hook = SwipeRefreshLayoutHook(this, view)
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
|
|
@@ -208,4 +211,40 @@ class NativeViewGestureHandler : GestureHandler<NativeViewGestureHandler>() {
|
|
|
208
211
|
|
|
209
212
|
override fun shouldCancelRootViewGestureHandlerIfNecessary() = true
|
|
210
213
|
}
|
|
214
|
+
|
|
215
|
+
private class SwipeRefreshLayoutHook(
|
|
216
|
+
private val handler: NativeViewGestureHandler,
|
|
217
|
+
private val swipeRefreshLayout: ReactSwipeRefreshLayout
|
|
218
|
+
) : NativeViewGestureHandlerHook {
|
|
219
|
+
override fun wantsToHandleEventBeforeActivation() = true
|
|
220
|
+
|
|
221
|
+
override fun handleEventBeforeActivation(event: MotionEvent) {
|
|
222
|
+
// RefreshControl from GH is set up in a way that ScrollView wrapped with it should wait for
|
|
223
|
+
// it to fail. This way the RefreshControl is not canceled by the scroll handler.
|
|
224
|
+
// The problem with this approach is that the RefreshControl handler stays active all the time
|
|
225
|
+
// preventing scroll from activating.
|
|
226
|
+
// This is a workaround to prevent it from happening.
|
|
227
|
+
|
|
228
|
+
// First get the ScrollView under the RefreshControl, if there is none, return.
|
|
229
|
+
val scroll = swipeRefreshLayout.getChildAt(0) as? ScrollView ?: return
|
|
230
|
+
|
|
231
|
+
// Then find the first NativeViewGestureHandler attached to it
|
|
232
|
+
val scrollHandler = handler.orchestrator
|
|
233
|
+
?.getHandlersForView(scroll)
|
|
234
|
+
?.first {
|
|
235
|
+
it is NativeViewGestureHandler
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// If handler was found, it's active and the ScrollView is not at the top, fail the RefreshControl
|
|
239
|
+
if (scrollHandler != null && scrollHandler.state == STATE_ACTIVE && scroll.scrollY > 0) {
|
|
240
|
+
handler.fail()
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// The drawback is that the smooth transition from scrolling to refreshing in a single swipe
|
|
244
|
+
// is impossible this way and two swipes are required:
|
|
245
|
+
// - one to go back to top
|
|
246
|
+
// - one to actually refresh
|
|
247
|
+
// oh well ¯\_(ツ)_/¯
|
|
248
|
+
}
|
|
249
|
+
}
|
|
211
250
|
}
|
|
@@ -229,12 +229,12 @@ class RNGestureHandlerButtonViewManager : ViewGroupManager<ButtonViewGroup>(), R
|
|
|
229
229
|
colorDrawable.setCornerRadius(borderRadius)
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
val layerDrawable = LayerDrawable(arrayOf(colorDrawable, selectable))
|
|
232
|
+
val layerDrawable = LayerDrawable(if (selectable != null) arrayOf(colorDrawable, selectable) else arrayOf(colorDrawable))
|
|
233
233
|
background = layerDrawable
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
private fun createSelectableDrawable(): Drawable {
|
|
237
|
+
private fun createSelectableDrawable(): Drawable? {
|
|
238
238
|
// TODO: remove once support for RN 0.63 is dropped, since 0.64 minSdkVersion is 21
|
|
239
239
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
|
240
240
|
context.theme.resolveAttribute(android.R.attr.selectableItemBackground, resolveOutValue, true)
|
|
@@ -242,6 +242,12 @@ class RNGestureHandlerButtonViewManager : ViewGroupManager<ButtonViewGroup>(), R
|
|
|
242
242
|
return resources.getDrawable(resolveOutValue.resourceId)
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
// Since Android 13, alpha channel in RippleDrawable is clamped between [128, 255]
|
|
246
|
+
// see https://github.com/aosp-mirror/platform_frameworks_base/blob/c1bd0480261460584753508327ca8a0c6fc80758/graphics/java/android/graphics/drawable/RippleDrawable.java#L1012
|
|
247
|
+
if (rippleColor == Color.TRANSPARENT && Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
248
|
+
return null
|
|
249
|
+
}
|
|
250
|
+
|
|
245
251
|
val states = arrayOf(intArrayOf(android.R.attr.state_enabled))
|
|
246
252
|
val rippleRadius = rippleRadius
|
|
247
253
|
val colorStateList = if (rippleColor != null) {
|
|
@@ -331,6 +337,7 @@ class RNGestureHandlerButtonViewManager : ViewGroupManager<ButtonViewGroup>(), R
|
|
|
331
337
|
// don't preform click when a child button is pressed (mainly to prevent sound effect of
|
|
332
338
|
// a parent button from playing)
|
|
333
339
|
return if (!isChildTouched() && soundResponder == this) {
|
|
340
|
+
tryFreeingResponder()
|
|
334
341
|
soundResponder = null
|
|
335
342
|
super.performClick()
|
|
336
343
|
} else {
|
|
@@ -16,13 +16,23 @@ import com.swmansion.gesturehandler.core.GestureHandler
|
|
|
16
16
|
class RNGestureHandlerEvent private constructor() : Event<RNGestureHandlerEvent>() {
|
|
17
17
|
private var extraData: WritableMap? = null
|
|
18
18
|
private var coalescingKey: Short = 0
|
|
19
|
+
|
|
20
|
+
// On the new architecture, native animated expects event names prefixed with `top` instead of `on`,
|
|
21
|
+
// since we know when the native animated node is the target of the event we can use the different
|
|
22
|
+
// event name where appropriate.
|
|
23
|
+
// TODO: This is a workaround not as solution, but doing this properly would require a total overhaul of
|
|
24
|
+
// how GH sends events (which needs to be done, but maybe wait until the RN's apis stop changing)
|
|
25
|
+
private var useTopPrefixedName: Boolean = false
|
|
26
|
+
|
|
19
27
|
private fun <T : GestureHandler<T>> init(
|
|
20
28
|
handler: T,
|
|
21
29
|
dataExtractor: RNGestureHandlerEventDataExtractor<T>?,
|
|
30
|
+
useNativeAnimatedName: Boolean
|
|
22
31
|
) {
|
|
23
32
|
super.init(handler.view!!.id)
|
|
24
33
|
extraData = createEventData(handler, dataExtractor)
|
|
25
34
|
coalescingKey = handler.eventCoalescingKey
|
|
35
|
+
this.useTopPrefixedName = useNativeAnimatedName
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
override fun onDispose() {
|
|
@@ -30,7 +40,7 @@ class RNGestureHandlerEvent private constructor() : Event<RNGestureHandlerEvent>
|
|
|
30
40
|
EVENTS_POOL.release(this)
|
|
31
41
|
}
|
|
32
42
|
|
|
33
|
-
override fun getEventName() = EVENT_NAME
|
|
43
|
+
override fun getEventName() = if (useTopPrefixedName) NATIVE_ANIMATED_EVENT_NAME else EVENT_NAME
|
|
34
44
|
|
|
35
45
|
override fun canCoalesce() = true
|
|
36
46
|
|
|
@@ -42,15 +52,17 @@ class RNGestureHandlerEvent private constructor() : Event<RNGestureHandlerEvent>
|
|
|
42
52
|
|
|
43
53
|
companion object {
|
|
44
54
|
const val EVENT_NAME = "onGestureHandlerEvent"
|
|
55
|
+
const val NATIVE_ANIMATED_EVENT_NAME = "topGestureHandlerEvent"
|
|
45
56
|
private const val TOUCH_EVENTS_POOL_SIZE = 7 // magic
|
|
46
57
|
private val EVENTS_POOL = Pools.SynchronizedPool<RNGestureHandlerEvent>(TOUCH_EVENTS_POOL_SIZE)
|
|
47
58
|
|
|
48
59
|
fun <T : GestureHandler<T>> obtain(
|
|
49
60
|
handler: T,
|
|
50
61
|
dataExtractor: RNGestureHandlerEventDataExtractor<T>?,
|
|
62
|
+
useTopPrefixedName: Boolean = false
|
|
51
63
|
): RNGestureHandlerEvent =
|
|
52
64
|
(EVENTS_POOL.acquire() ?: RNGestureHandlerEvent()).apply {
|
|
53
|
-
init(handler, dataExtractor)
|
|
65
|
+
init(handler, dataExtractor, useTopPrefixedName)
|
|
54
66
|
}
|
|
55
67
|
|
|
56
68
|
fun <T : GestureHandler<T>> createEventData(
|
|
@@ -538,7 +538,11 @@ class RNGestureHandlerModule(reactContext: ReactApplicationContext?) :
|
|
|
538
538
|
sendEventForReanimated(event)
|
|
539
539
|
} else if (handler.actionType == GestureHandler.ACTION_TYPE_NATIVE_ANIMATED_EVENT) {
|
|
540
540
|
// Animated with useNativeDriver: true
|
|
541
|
-
val event = RNGestureHandlerEvent.obtain(
|
|
541
|
+
val event = RNGestureHandlerEvent.obtain(
|
|
542
|
+
handler,
|
|
543
|
+
handlerFactory,
|
|
544
|
+
useTopPrefixedName = BuildConfig.REACT_NATIVE_MINOR_VERSION >= 71
|
|
545
|
+
)
|
|
542
546
|
sendEventForNativeAnimatedEvent(event)
|
|
543
547
|
} else if (handler.actionType == GestureHandler.ACTION_TYPE_JS_FUNCTION_OLD_API) {
|
|
544
548
|
// JS function, Animated.event with useNativeDriver: false using old API
|
|
@@ -3,57 +3,23 @@ cmake_minimum_required(VERSION 3.9.0)
|
|
|
3
3
|
|
|
4
4
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
5
5
|
set(CMAKE_CXX_STANDARD 17)
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
set(REACT_ANDROID_DIR "${REACT_NATIVE_DIR}/ReactAndroid")
|
|
8
|
+
|
|
9
|
+
include(${REACT_ANDROID_DIR}/cmake-utils/folly-flags.cmake)
|
|
10
|
+
add_compile_options(${folly_FLAGS})
|
|
7
11
|
|
|
8
12
|
add_library(gesturehandler
|
|
9
13
|
SHARED
|
|
10
14
|
cpp-adapter.cpp
|
|
11
15
|
)
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
set(REACT_COMMON_DIR "${REACT_NATIVE_DIR}/ReactCommon")
|
|
15
|
-
set(REACT_NDK_EXPORT_DIR "${APP_BUILD_DIR}/react-ndk/exported")
|
|
16
|
-
|
|
17
|
-
# copied from react-native/ReactAndroid/cmake-utils/Android-prebuilt.cmake
|
|
18
|
-
|
|
19
|
-
## jsi
|
|
20
|
-
add_library(jsi SHARED IMPORTED GLOBAL)
|
|
21
|
-
set_target_properties(jsi
|
|
22
|
-
PROPERTIES
|
|
23
|
-
IMPORTED_LOCATION
|
|
24
|
-
${REACT_NDK_EXPORT_DIR}/${ANDROID_ABI}/libjsi.so)
|
|
25
|
-
target_include_directories(jsi INTERFACE ${REACT_COMMON_DIR}/jsi)
|
|
26
|
-
|
|
27
|
-
## react_render_core
|
|
28
|
-
add_library(react_render_core SHARED IMPORTED GLOBAL)
|
|
29
|
-
set_target_properties(react_render_core
|
|
30
|
-
PROPERTIES
|
|
31
|
-
IMPORTED_LOCATION
|
|
32
|
-
${REACT_NDK_EXPORT_DIR}/${ANDROID_ABI}/libreact_render_core.so)
|
|
33
|
-
target_include_directories(react_render_core
|
|
34
|
-
INTERFACE
|
|
35
|
-
${REACT_COMMON_DIR}
|
|
36
|
-
${REACT_COMMON_DIR}/react/renderer/core)
|
|
37
|
-
|
|
38
|
-
## react_render_uimanager
|
|
39
|
-
add_library(react_render_uimanager SHARED IMPORTED GLOBAL)
|
|
40
|
-
set_target_properties(react_render_uimanager
|
|
41
|
-
PROPERTIES
|
|
42
|
-
IMPORTED_LOCATION
|
|
43
|
-
${REACT_NDK_EXPORT_DIR}/${ANDROID_ABI}/libreact_render_uimanager.so)
|
|
44
|
-
target_include_directories(react_render_uimanager INTERFACE ${REACT_COMMON_DIR}/react/renderer/uimanager)
|
|
45
|
-
|
|
46
|
-
target_include_directories(
|
|
47
|
-
gesturehandler
|
|
48
|
-
PRIVATE
|
|
49
|
-
"${REACT_ANDROID_DIR}/build/third-party-ndk/boost/boost_1_76_0"
|
|
50
|
-
"${REACT_ANDROID_DIR}/build/third-party-ndk/double-conversion"
|
|
51
|
-
"${REACT_ANDROID_DIR}/build/third-party-ndk/folly"
|
|
52
|
-
)
|
|
17
|
+
find_package(ReactAndroid REQUIRED CONFIG)
|
|
53
18
|
|
|
54
19
|
target_link_libraries(
|
|
55
20
|
gesturehandler
|
|
56
|
-
|
|
57
|
-
react_render_uimanager
|
|
58
|
-
|
|
21
|
+
ReactAndroid::react_render_core
|
|
22
|
+
ReactAndroid::react_render_uimanager
|
|
23
|
+
ReactAndroid::jsi
|
|
24
|
+
ReactAndroid::react_nativemodule_core
|
|
59
25
|
)
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
using namespace facebook;
|
|
7
7
|
using namespace react;
|
|
8
8
|
|
|
9
|
-
void decorateRuntime(jsi::Runtime &runtime)
|
|
10
|
-
{
|
|
9
|
+
void decorateRuntime(jsi::Runtime &runtime) {
|
|
11
10
|
auto isFormsStackingContext = jsi::Function::createFromHostFunction(
|
|
12
11
|
runtime,
|
|
13
12
|
jsi::PropNameID::forAscii(runtime, "isFormsStackingContext"),
|
|
@@ -15,27 +14,31 @@ void decorateRuntime(jsi::Runtime &runtime)
|
|
|
15
14
|
[](jsi::Runtime &runtime,
|
|
16
15
|
const jsi::Value &thisValue,
|
|
17
16
|
const jsi::Value *arguments,
|
|
18
|
-
size_t count) -> jsi::Value
|
|
19
|
-
|
|
20
|
-
if (!arguments[0].isObject())
|
|
21
|
-
{
|
|
17
|
+
size_t count) -> jsi::Value {
|
|
18
|
+
if (!arguments[0].isObject()) {
|
|
22
19
|
return jsi::Value::null();
|
|
23
20
|
}
|
|
24
21
|
|
|
25
|
-
auto shadowNode = arguments[0]
|
|
26
|
-
|
|
22
|
+
auto shadowNode = arguments[0]
|
|
23
|
+
.asObject(runtime)
|
|
24
|
+
.getHostObject<ShadowNodeWrapper>(runtime)
|
|
25
|
+
->shadowNode;
|
|
26
|
+
bool isFormsStackingContext = shadowNode->getTraits().check(
|
|
27
|
+
ShadowNodeTraits::FormsStackingContext);
|
|
27
28
|
|
|
28
29
|
return jsi::Value(isFormsStackingContext);
|
|
29
30
|
});
|
|
30
|
-
runtime.global().setProperty(
|
|
31
|
+
runtime.global().setProperty(
|
|
32
|
+
runtime, "isFormsStackingContext", std::move(isFormsStackingContext));
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
extern "C" JNIEXPORT void JNICALL
|
|
34
|
-
Java_com_swmansion_gesturehandler_react_RNGestureHandlerModule_decorateRuntime(
|
|
35
|
-
|
|
36
|
+
Java_com_swmansion_gesturehandler_react_RNGestureHandlerModule_decorateRuntime(
|
|
37
|
+
JNIEnv *env,
|
|
38
|
+
jobject clazz,
|
|
39
|
+
jlong jsiPtr) {
|
|
36
40
|
jsi::Runtime *runtime = reinterpret_cast<jsi::Runtime *>(jsiPtr);
|
|
37
|
-
if (runtime)
|
|
38
|
-
{
|
|
41
|
+
if (runtime) {
|
|
39
42
|
decorateRuntime(*runtime);
|
|
40
43
|
}
|
|
41
44
|
}
|