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

Update wp-fork to version 2.3.2 #20

Merged
merged 57 commits into from
May 25, 2022
Merged

Update wp-fork to version 2.3.2 #20

merged 57 commits into from
May 25, 2022

Conversation

fluiddot
Copy link

@fluiddot fluiddot commented Apr 8, 2022

This PR updates the wp-fork branch with upstream version 2.3.2 and applies the required changes to publish the Android library associated with the package.

Since the PR contains a massive amount of changed files, in order to review this PR, it's better to compare the branch with the upstream repository and validate that we apply the same changes we have in wp-fork:

NOTE: Once this PR is ready, we should also merge #19 so the diff showed in wp-fork doesn't contain the 2.3.2 version changes.

Testing instructions

  1. Apply the following patch to the Gutenberg project:
diff --git a/packages/react-native-editor/android/app/build.gradle b/packages/react-native-editor/android/app/build.gradle
index a75a855cd7990a6813405c00e04b2ea45456ac8d..6a7b6ecadd60b540eaa082737a517ccd53c1365b 100644
--- a/packages/react-native-editor/android/app/build.gradle
+++ b/packages/react-native-editor/android/app/build.gradle
@@ -186,7 +186,7 @@ dependencies {
     implementation "com.github.wordpress-mobile:react-native-slider:${extractPackageVersion(packageJson, '@react-native-community/slider', 'dependencies')}"
     implementation "org.wordpress-mobile:react-native-get-random-values:${extractPackageVersion(packageJson, 'react-native-get-random-values', 'dependencies')}"
     implementation "org.wordpress-mobile:react-native-masked-view:${extractPackageVersion(packageJson, '@react-native-masked-view/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:wp-fork-2.3.2-SNAPSHOT'
     implementation "org.wordpress-mobile:react-native-screens:${extractPackageVersion(packageJson, 'react-native-screens', 'dependencies')}"
     implementation "org.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/src/main/java/com/gutenberg/MainApplication.java b/packages/react-native-editor/android/app/src/main/java/com/gutenberg/MainApplication.java
index d74315aba221a2444181d6677e15d60980306a48..b94e581a736cbe1bf6f05bc338b448a889eb89a8 100644
--- a/packages/react-native-editor/android/app/src/main/java/com/gutenberg/MainApplication.java
+++ b/packages/react-native-editor/android/app/src/main/java/com/gutenberg/MainApplication.java
@@ -37,7 +37,7 @@ import com.facebook.react.ReactPackage;
 import com.facebook.react.shell.MainReactPackage;
 import com.facebook.soloader.SoLoader;
 import com.reactnativecommunity.webview.RNCWebViewPackage;
-import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
+import com.swmansion.gesturehandler.RNGestureHandlerPackage;
 import com.swmansion.reanimated.ReanimatedJSIModulePackage;
 import com.swmansion.reanimated.ReanimatedPackage;
 import com.swmansion.rnscreens.RNScreensPackage;
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 a55491b687660565098361c00d02b20d4dd52663..6c9930ece54cf909a385b792655513522a420e5b 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,7 @@ dependencies {
     implementation "com.github.wordpress-mobile:react-native-slider:${extractPackageVersion(packageJson, '@react-native-community/slider', 'dependencies')}"
     implementation "org.wordpress-mobile:react-native-get-random-values:${extractPackageVersion(packageJson, 'react-native-get-random-values', 'dependencies')}"
     implementation "org.wordpress-mobile:react-native-masked-view:${extractPackageVersion(packageJson, '@react-native-masked-view/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:wp-fork-2.3.2-SNAPSHOT'
     implementation "org.wordpress-mobile:react-native-screens:${extractPackageVersion(packageJson, 'react-native-screens', 'dependencies')}"
     implementation "org.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. Build the Gutenberg demo app (i.e. packages/react-native-editor/android project).
  2. Observe that the project can be built without errors.
  3. Run the Gutenberg demo app and observe that works as expected.

byCedric and others added 30 commits January 18, 2022 11:37
…n#1827)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
A small update to the issue template that adds two things:

- Since Gesture Handler 2 is closely integrated with Reanimated 2, I think it's a good idea to ask for its version explicitly.
- Many issues are missing information about affected platforms which makes it harder to reproduce them. This PR adds a new section about affected platforms.
The `speed` option wasn't used in `openDrawer` and `closeDrawer` methods of `DrawerLayout`. This PR changes it, so it's passed further along to the method responsible for animating the drawer.
…e-mansion#1684)

The handlers collection must have been modified in other place and the registry is the only class that modifies it. My guess is that the handler was dropped or removed from view and relevant method was called (asynchronously)
causing the list to be modified while it was being iterated over. This PR locks the list while it's being modified or iterated over.
## Description

This PR introduces a GitHub Actions bot used for triaging issues - checking an issue template, assigning labels, and checking for reproduction. Its purpose is to save time on reviewing and replying to incomplete issues.

GitHub Actions code responsible for these actions can be found here: https://github.com/software-mansion-labs/swmansion-bot

## Changes

- Added `needs-more-info.yml` - an action used for checking whether the issue template fields are filled
- Added `needs-repro.yml` - an action used for checking whether the issue has a snack, GitHub repo, or a snippet of JavaScript/TypeScript code
- Added `platforms.yml` - an action that assigns labels to user-selected platforms in the issue template
- Added `close-when-stale.yml` - an action that closes an issue after 20 days of inactivity if it has the `Abandoned` label

- Added `Missing info` & `Repro provided` label

`needs-repro` action is triggered both by issue creation/edition and by comments. To prevent bot responses to old issues optional prop `check-issues-only-created-after` is set to 1 February 2022. This will assure that this action will be triggered only by comments on issues created after 2022-02-01.
At the moment, Reanimated event is rebuilt on every update which may cause a heavy performance hit in some cases. I believe that it's a leftover from pre-release Gesture Handler 2. This PR changes it so that the event will be rebuilt only when the gestures are reattached alleviating performance issues.

Should fix software-mansion#1849.
Fix tvOS compilation errors by excluding unsupported parts of the code when building for it.

Should fix software-mansion#1813.
Co-authored-by: Jakub Piasecki <jakub.piasecki@swmansion.com>
Co-authored-by: Krzysztof Piaskowy <krzychu2956@gmail.com>
…nsion#1863)

Update React Native version in the Example app to 0.67.2
Make the app build on M1 Mac
- Add `runOnJS` modifier that makes callbacks of the event to be ran on the JS thread.
- Modified `GestureDetector` to make use of this modifier and filter out unnecessary gestures when assigning them to the value read by the Reanimated hook. Gestures marked with `runOnJS` will now be registered for device events regardless of whether its callbacks are worklets or not.
- Show error when trying to use gesture with only some of the callbacks marked as worklets without marking it with `runOnJS`.
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…n#1874)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
software-mansion#1888)

Change how device event subscriptions are removed to use `.remove()` on subscription itself instead of `DeviceEventEmitter.removeSubscription(...)`.
Add `tagMessage` function in utils that adds a standard tag to the message.
Update existing `console.warn` and `console.error` invocations to make use of the new method.
"Abandoned" isn't applicable in case of issues.
Fixes TypeScript errors.
On web, apps would crash due to process property missing on global. This PR adds a check for it, so web apps work correctly.
`@testing-library/jest-native` and `@testing-library/react-native` are dev dependencies we cannot assume they will be always available. This PR makes jestUtils import fireEvent only when its available.
dependabot bot and others added 14 commits March 2, 2022 09:48
Bumps [plist](https://github.com/TooTallNate/node-plist) from 3.0.1 to 3.0.4.
- [Release notes](https://github.com/TooTallNate/node-plist/releases)
- [Changelog](https://github.com/TooTallNate/plist.js/blob/master/History.md)
- [Commits](https://github.com/TooTallNate/node-plist/commits)

---
updated-dependencies:
- dependency-name: plist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.7 to 1.5.10.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](unshiftio/url-parse@1.5.7...1.5.10)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.7 to 1.5.10.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](unshiftio/url-parse@1.5.7...1.5.10)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.25.0 to 1.27.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](PrismJS/prism@v1.25.0...v1.27.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
In cases where `TouchableOpacity` and `TouchableNativeFeedback` were used together, but `TouchableOpacity` was placed first, the color of ripple animation would also be set to `transparent` for `TouchableNativeFeedback`. This PR changes the behavior of GestureHandlerButton so that it will set the color of ripple animation to [`android.R.attr.colorControlHighlight`](https://developer.android.com/reference/android/R.attr#colorControlHighlight) when no color is set by the user.
…oftware-mansion#1908)

Fixes import of `StyleSheet` in `RNGestureHandlerButtonNativeComponent.js`.
…signed (software-mansion#1910)

Fix related to comment [here](software-mansion#1844 (comment)) about `RNGestureHandlerButton` with `handlerType="NativeViewGestureHandler"` having missing testIDs when they were previously provided and assigned. The `testID` on the child being cloned within `createHandler` was being removed by the `testID` being set within the render function even the `testID` on the handler was not set. Now it will only assign a `testID` as a prop on the cloned element if a `testID` was provided to the handler.
…sion#1926)

- Add manual gestures example based on tutorial from documentation
- Fix Drag and drop example, had bug, onLongPress callback method should run on JSThread that can execute the `setState`
…on#1925)

Update the example code for PanGestureHandler. It can now be easily copy-pasted as a whole.
- makes Gesture Handler's TouchableOpacity use native driver for animations by default
- adds prop that allows to disable it
…package.json` (software-mansion#1917)

Moves `jestUtils` to a separate package so it's not bundled when not actually used. This caused problems with `testing-library`, namely one of its dependencies - `ansi-styles`. It uses named capture groups in regex which is unsupported on Hermes.

Fixes software-mansion#1913.
@fluiddot fluiddot self-assigned this Apr 8, 2022
# Conflicts:
#	RNGestureHandler.podspec
#	android/build.gradle
#	package.json
#	src/handlers/createHandler.ts
#	src/utils.ts
#	tsconfig.json
#	yarn.lock
@fluiddot fluiddot marked this pull request as ready for review April 8, 2022 11:22
@fluiddot fluiddot requested a review from geriux April 8, 2022 11:22
@geriux
Copy link
Member

geriux commented Apr 11, 2022

Hey @fluiddot 👋

I tried to test this using the patch but it looks like it only works if there's no Reanimated / Gesture Handler code being rendered.

If there's some Reanimated / Gesture handler code being rendered It crashes with the following error

java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Double

Maybe I'm missing something 😅

@fluiddot
Copy link
Author

I tried to test this using the patch but it looks like it only works if there's no Reanimated / Gesture Handler code being rendered.

If there's some Reanimated / Gesture handler code being rendered It crashes with the following error

java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Double

Maybe I'm missing something 😅

@geriux oh, that's probably caused by using a different version on the JS side, actually, I think I forgot to add to the patch the reference change to the dependency in the package.json. react-native-gesture-handler package should point to the tarball generated in this PR:

"react-native-gesture-handler": "https://raw.githubusercontent.com/wordpress-mobile/react-native-gesture-handler/wp-fork-2.3.2/react-native-gesture-handler-2.3.2-wp-1.tgz",

Copy link
Member

@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!

@fluiddot
Copy link
Author

@geriux heads up that I'm going to put the merge on hold until I open a PR in Gutenberg to update this dependency. I'll let you know when it's ready.

Once that PR is ready to merge, we could start merging the different PRs.

@geriux
Copy link
Member

geriux commented Apr 19, 2022

@geriux heads up that I'm going to put the merge on hold until I open a PR in Gutenberg to update this dependency. I'll let you know when it's ready.

Sounds good! 👍

@fluiddot
Copy link
Author

@geriux heads up that I'm going to put the merge on hold until I open a PR in Gutenberg to update this dependency. I'll let you know when it's ready.

Once that PR is ready to merge, we could start merging the different PRs.

@geriux I created this PR for updating the package in the Gutenberg repository, so I'll start merging these changes as soon as possible.

@fluiddot fluiddot merged commit ffe2765 into wp-fork May 25, 2022
@fluiddot fluiddot deleted the wp-fork-2.3.2 branch May 25, 2022 15:57
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.