Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Prevent Reanimated duplicated class#18

Merged
fluiddot merged 3 commits intowp-forkfrom
prevent-reanimated-duplicated-class
Mar 16, 2022
Merged

Prevent Reanimated duplicated class#18
fluiddot merged 3 commits intowp-forkfrom
prevent-reanimated-duplicated-class

Conversation

@fluiddot
Copy link
Copy Markdown

@fluiddot fluiddot commented Mar 15, 2022

Related to wordpress-mobile/WordPress-Android#16106 (comment), we have to assure that we use the common interface from Reanimated when using react-native-reanimated version 2.3 or higher, otherwise, the build will fail due to having a class duplicated.

This is automatically detected by the library during building, but since it relies on having Reanimated included in the project and it's published via a forked repository, this logic is not being applied.

Additionally, since we have to include Reanimated as a dependency, we'll include it from the forked version.

To test:

  1. Apply the following patch in the changes of [RNMobile] Update react-native-reanimated version to 2.4.1 WordPress/gutenberg#39430:
diff --git a/packages/react-native-bridge/android/react-native-bridge/build.gradle b/packages/react-native-bridge/android/react-native-bridge/build.gradle
index 40aac5556a5aba029ec86d75276da5b94b239b67..fabe0105ca1b8abb447ff91d920f811158827a36 100644
--- a/packages/react-native-bridge/android/react-native-bridge/build.gradle
+++ b/packages/react-native-bridge/android/react-native-bridge/build.gradle
@@ -70,7 +70,8 @@ dependencies {
     implementation "com.github.wordpress-mobile:react-native-slider:${extractPackageVersion(packageJson, '@react-native-community/slider', 'dependencies')}"
     implementation "com.github.wordpress-mobile:react-native-get-random-values:${extractPackageVersion(packageJson, 'react-native-get-random-values', 'dependencies')}"
     implementation "com.github.wordpress-mobile:react-native-masked-view:${extractPackageVersion(packageJson, '@react-native-community/masked-view', 'dependencies')}"
-    implementation "com.github.wordpress-mobile:react-native-gesture-handler:${extractPackageVersion(packageJson, 'react-native-gesture-handler', 'dependencies')}"
+    // implementation "com.github.wordpress-mobile:react-native-gesture-handler:${extractPackageVersion(packageJson, 'react-native-gesture-handler', 'dependencies')}"
+    implementation 'com.github.wordpress-mobile:react-native-gesture-handler:prevent-reanimated-duplicated-class-SNAPSHOT'
     implementation "com.github.wordpress-mobile:react-native-screens:${extractPackageVersion(packageJson, 'react-native-screens', 'dependencies')}"
     implementation "com.github.wordpress-mobile:react-native-safe-area-context:${extractPackageVersion(packageJson, 'react-native-safe-area-context', 'dependencies')}"
     implementation "com.github.wordpress-mobile:react-native-reanimated:${extractPackageVersion(packageJson, 'react-native-reanimated', 'dependencies')}"
diff --git a/packages/react-native-editor/android/app/build.gradle b/packages/react-native-editor/android/app/build.gradle
index 967b85b736badad8560a6ce740cc7e6a6abb33ee..a73cca721e805fe3a0b6451f455349b393e4aa08 100644
--- a/packages/react-native-editor/android/app/build.gradle
+++ b/packages/react-native-editor/android/app/build.gradle
@@ -186,7 +186,8 @@ dependencies {
     implementation "com.github.wordpress-mobile:react-native-slider:${extractPackageVersion(packageJson, '@react-native-community/slider', 'dependencies')}"
     implementation "com.github.wordpress-mobile:react-native-get-random-values:${extractPackageVersion(packageJson, 'react-native-get-random-values', 'dependencies')}"
     implementation "com.github.wordpress-mobile:react-native-masked-view:${extractPackageVersion(packageJson, '@react-native-community/masked-view', 'dependencies')}"
-    implementation "com.github.wordpress-mobile:react-native-gesture-handler:${extractPackageVersion(packageJson, 'react-native-gesture-handler', 'dependencies')}"
+    // implementation "com.github.wordpress-mobile:react-native-gesture-handler:${extractPackageVersion(packageJson, 'react-native-gesture-handler', 'dependencies')}"
+    implementation 'com.github.wordpress-mobile:react-native-gesture-handler:prevent-reanimated-duplicated-class-SNAPSHOT'
     implementation "com.github.wordpress-mobile:react-native-screens:${extractPackageVersion(packageJson, 'react-native-screens', 'dependencies')}"
     implementation "com.github.wordpress-mobile:react-native-safe-area-context:${extractPackageVersion(packageJson, 'react-native-safe-area-context', 'dependencies')}"
     implementation "com.github.wordpress-mobile:react-native-reanimated:${extractPackageVersion(packageJson, 'react-native-reanimated', 'dependencies')}"
  1. Try to build the demo app.
  2. Observe that no errors are displayed.

@fluiddot fluiddot self-assigned this Mar 15, 2022
Copy link
Copy Markdown

@geriux geriux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I tested these changes applying the patch and it works correctly 🎉 🚀

@fluiddot fluiddot merged commit 0630ab3 into wp-fork Mar 16, 2022
@fluiddot fluiddot deleted the prevent-reanimated-duplicated-class branch March 16, 2022 08:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants