From fbf451cc4f1907d8309fb85e36ec6698ce5b0eb3 Mon Sep 17 00:00:00 2001 From: Wojciech Lewicki Date: Fri, 1 Mar 2024 11:55:54 +0100 Subject: [PATCH] feat: add necessary changes for new arch on RN 0.74 (#2766) ## Description PR with necessary changes for new arch bridgeless support on RN 0.74 ## Test plan --------- Co-authored-by: Jakub Piasecki --- .github/workflows/ios-build.yml | 6 +- FabricExample/.gitignore | 12 +- FabricExample/Gemfile | 6 +- FabricExample/Gemfile.lock | 4 +- FabricExample/android/app/build.gradle | 1 - .../java/com/fabricexample/MainApplication.kt | 4 +- .../res/drawable/rn_edit_text_material.xml | 3 +- FabricExample/android/build.gradle | 6 +- FabricExample/android/gradle.properties | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- FabricExample/android/gradlew | 16 +- FabricExample/android/gradlew.bat | 20 +- .../FabricExample.xcodeproj/project.pbxproj | 24 +- .../ios/FabricExample/AppDelegate.mm | 5 + FabricExample/ios/FabricExample/Info.plist | 2 +- FabricExample/ios/Podfile | 19 +- FabricExample/ios/Podfile.lock | 928 +++++++++--------- FabricExample/metro.config.js | 2 +- FabricExample/package.json | 10 +- FabricExample/yarn.lock | 656 +++++++------ RNGestureHandler.podspec | 25 +- android/build.gradle | 2 +- .../gesturehandler/RNGestureHandlerPackage.kt | 13 +- .../react/RNGestureHandlerModule.kt | 10 +- .../react/RNGestureHandlerRootHelper.kt | 5 +- android/src/main/jni/cpp-adapter.cpp | 40 +- apple/RNGestureHandlerModule.h | 3 +- apple/RNGestureHandlerModule.mm | 24 +- example/ios/Podfile | 6 + example/ios/Podfile.lock | 4 +- src/__tests__/Events.test.tsx | 8 +- src/getShadowNodeFromRef.ts | 34 +- src/handlers/createHandler.tsx | 6 + src/specs/NativeRNGestureHandlerModule.ts | 16 +- 34 files changed, 1001 insertions(+), 923 deletions(-) diff --git a/.github/workflows/ios-build.yml b/.github/workflows/ios-build.yml index cf09868ae1..b2b53f4f44 100644 --- a/.github/workflows/ios-build.yml +++ b/.github/workflows/ios-build.yml @@ -14,7 +14,7 @@ on: jobs: build: if: github.repository == 'software-mansion/react-native-gesture-handler' - runs-on: macos-12 + runs-on: macos-14 strategy: matrix: working-directory: [example, FabricExample] @@ -24,6 +24,10 @@ jobs: steps: - name: checkout uses: actions/checkout@v2 + - name: Use latest stable Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable - name: Use Node.js 18 uses: actions/setup-node@v2 with: diff --git a/FabricExample/.gitignore b/FabricExample/.gitignore index 0cab2ac6fc..cfe6bd027e 100644 --- a/FabricExample/.gitignore +++ b/FabricExample/.gitignore @@ -20,7 +20,7 @@ DerivedData *.hmap *.ipa *.xcuserstate -ios/.xcode.env.local +**/.xcode.env.local # Android/IntelliJ # @@ -56,7 +56,7 @@ yarn-error.log *.jsbundle # Ruby / CocoaPods -/ios/Pods/ +**/Pods/ /vendor/bundle/ # Temporary files created by Metro to check the health of the file watcher @@ -64,3 +64,11 @@ yarn-error.log # testing /coverage + +# Yarn +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions \ No newline at end of file diff --git a/FabricExample/Gemfile b/FabricExample/Gemfile index ee74536c5e..ec21e32c9a 100644 --- a/FabricExample/Gemfile +++ b/FabricExample/Gemfile @@ -3,5 +3,7 @@ source 'https://rubygems.org' # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version ruby ">= 2.6.10" -gem 'cocoapods', '~> 1.13' -gem 'activesupport', '>= 6.1.7.3', '< 7.1.0' \ No newline at end of file +# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper +# bound in the template on Cocoapods with next React Native release. +gem 'cocoapods', '>= 1.13', '< 1.15' +gem 'activesupport', '>= 6.1.7.5', '< 7.1.0' \ No newline at end of file diff --git a/FabricExample/Gemfile.lock b/FabricExample/Gemfile.lock index 9a00e0270d..960de8165a 100644 --- a/FabricExample/Gemfile.lock +++ b/FabricExample/Gemfile.lock @@ -89,8 +89,8 @@ PLATFORMS ruby DEPENDENCIES - activesupport (>= 6.1.7.3, < 7.1.0) - cocoapods (~> 1.13) + activesupport (>= 6.1.7.5, < 7.1.0) + cocoapods (>= 1.13, < 1.15) RUBY VERSION ruby 2.7.5p203 diff --git a/FabricExample/android/app/build.gradle b/FabricExample/android/app/build.gradle index 4188518176..01cb955a88 100644 --- a/FabricExample/android/app/build.gradle +++ b/FabricExample/android/app/build.gradle @@ -154,7 +154,6 @@ dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") - implementation("com.facebook.react:flipper-integration") if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { diff --git a/FabricExample/android/app/src/main/java/com/fabricexample/MainApplication.kt b/FabricExample/android/app/src/main/java/com/fabricexample/MainApplication.kt index 6965a5b9aa..9f6764235c 100644 --- a/FabricExample/android/app/src/main/java/com/fabricexample/MainApplication.kt +++ b/FabricExample/android/app/src/main/java/com/fabricexample/MainApplication.kt @@ -9,7 +9,6 @@ import com.facebook.react.ReactPackage import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost import com.facebook.react.defaults.DefaultReactNativeHost -import com.facebook.react.flipper.ReactNativeFlipper import com.facebook.soloader.SoLoader class MainApplication : Application(), ReactApplication { @@ -31,7 +30,7 @@ class MainApplication : Application(), ReactApplication { } override val reactHost: ReactHost - get() = getDefaultReactHost(this.applicationContext, reactNativeHost) + get() = getDefaultReactHost(applicationContext, reactNativeHost) override fun onCreate() { super.onCreate() @@ -40,6 +39,5 @@ class MainApplication : Application(), ReactApplication { // If you opted-in for the New Architecture, we load the native entry point for this app. load() } - ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager) } } diff --git a/FabricExample/android/app/src/main/res/drawable/rn_edit_text_material.xml b/FabricExample/android/app/src/main/res/drawable/rn_edit_text_material.xml index f35d996202..650a08a95b 100644 --- a/FabricExample/android/app/src/main/res/drawable/rn_edit_text_material.xml +++ b/FabricExample/android/app/src/main/res/drawable/rn_edit_text_material.xml @@ -17,7 +17,8 @@ android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material" android:insetRight="@dimen/abc_edit_text_inset_horizontal_material" android:insetTop="@dimen/abc_edit_text_inset_top_material" - android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"> + android:insetBottom="@dimen/abc_edit_text_inset_bottom_material" + >