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

Update trunk with upstream version 2.3.2 #19

Merged
merged 53 commits into from
May 25, 2022
Merged

Update trunk with upstream version 2.3.2 #19

merged 53 commits into from
May 25, 2022

Conversation

fluiddot
Copy link

@fluiddot fluiddot commented Apr 8, 2022

This PR updates trunk with upstream version 2.3.2 (commit: software-mansion@aebd2f5).

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.
j-piasecki and others added 23 commits February 28, 2022 13:15
Adds entry in documentation for runOnJS modifier on gestures.
* Restore original Podfile in example app

* Update Podfile.lock
* Init FabricExample

* Add MBFingerTipWindow to FabricExample

* Add icons to FabricExample

* Update .prettierrc

* Revert "Add MBFingerTipWindow to FabricExample"

This reverts commit 51514c2.

* Bump FabricExample to 0.68.0-rc.2

Co-authored-by: Jakub Piasecki <jakub.piasecki@swmansion.com>
* Attach for device events (software-mansion#1561)

Add support for sending gesture events as device events alongside direct events.

* Add Reanimated as dependency (software-mansion#1573)

Temporarily add Reanimated as peer dependency to allow for testing interactions between it and the new api. This change should be reverted in the future.

* Add Gestures with InteractionBuilder (software-mansion#1572)

Add classes representing all basic gestures.
Add InteractionBuilder for easy composition of gestures.
Updates old gesture handlers to share parts of config with the new gestures.

* Add GestureMonitor and hooks (software-mansion#1574)

Add GestureMonitor, useGesture and useAnimatedGesture, which allows for using the new API.

* Add more examples (software-mansion#1584)

Adds a few more examples:
- Imitation of a camera viewfinder with filters, pinch-to-zoom, and option to long-press the shutter button to record video
- Imitation of a calculator app with expandable side panels and scrollable history
- Simple transformations demo
- Test for overlapping elements

* Fix TS errors and handlers not attaching (software-mansion#1589)

Fixed TypeScript type errors
Removed unnecessary setImmediate that caused callback to be set too late

* Fix wrong variable name (software-mansion#1591)

Fix wrong variable name.

* Add conditional import of Reanimated (software-mansion#1592)

Adds Reanimated as an optional dependency.

Co-authored-by: Jakub <jakub.gonet@swmansion.com>

* Rename gestures methods' to remove set (software-mansion#1596)

Remove set prefix from gestures methods'.

* Remove hooks and consolidate logic in GestureMonitor (software-mansion#1595)

The useGesture and useAnimatedGesture hooks have been removed. Instead of them you can pass BaseGesture or InteractionBuilder directly to gesture (or the new animatedGesture) prop of the GestureMonitor.
GestureMonitor has been refactored and inherited most of the logic from hooks.
Examples have been updated to support these changes.

* Remove InteractionBuilder and replace it with explicit interactions (software-mansion#1597)

Remove InteractionBuilder because the way it was building relations between gestures was not obvious.
Add Gesture.exclusive, Gesture.simultaneous and Gesture.requireToFail methods for more explicit way of composing gestures. While this method is more verbose, it should be easily understandable.

* Rename methods and GestureMonitor (software-mansion#1600)

Rename methods used for creating gestures to start with an upper case letter.
Rename GestureMonitor to GestureDetector.

* Update docs (software-mansion#1604)

Adds basic docs about the new api. Parts about gestures are nearly identical to those about gesture handlers with slight naming modifications and type annotations. The docs will need to be updated when we solidify naming convention and update types.
Moves minPointers prop only to Pan and Tap gestures and gesture handlers as they are the only ones that use it.
Changes type in FlingGesture direction to be consistent with the docs.

* Rename composition methods (software-mansion#1614)

Rename Gesture.Exclusive to Gesture.Race.
Rename Gesture.RequireToFail to Gesture.Exclusive.
Rename gestureInteractions.ts to gestureComposition.ts.

* Remove leftover set prefix (software-mansion#1619)

Remove leftover set prefix.

* Add collapsable prop to the child of the Wrap (software-mansion#1636)

Modifies the Wrap component used by the GestureDetector to find the viewTag of the view it should attach to. By adding the collapsable: false prop it makes sure that the child view of the wrap ends up in the view hierarchy.
Note that there are still problems when there is a View used just to group components (no props) inside a functional component that is a child of a GestureDetector.

* Make Gesture.Simultaneous accept variable number of arguments (software-mansion#1625)

Current implementation of nesting gestures in pairs may suggest that the ordering of the gestures in Simultaneous matters, and it is not really necessary to limit it in this way. This change allows Gesture.Simultaneous to accept multiple gestures at once.

* Make external relations methods accept variable number of arguments (software-mansion#1633)

Makes simultaneousWithExternalGesture and requireExternalGestureToFail accept a variable number of arguments.

* Make Gesture.Exclusive accept a variable number of arguments (software-mansion#1629)

While I don't think there are many use cases where deep nesting of Gesture.Exclusive would be required, with Gesture.Simultaneous and Gesture.Race both accepting a variable number of arguments I changed Exclusive to also accept more than two for the sake of consistency.

* Add native gesture (software-mansion#1628)

Adds a NativeGesture object alongside Gesture.Native() method to incorporate NativeViewGestureHandler to the new API.

* Use arrow functions in the Gesture object (software-mansion#1632)

Changes the member methods of the exported Gesture object to use the arrow syntax for explicit binding of this. Because of this you no longer get eslint error when destructuring it.

* Create a BetterDrawerLayout component (software-mansion#1623)

Create a new BetterDrawerLayout component built with the new API of the gesture handler and Reanimated 2. It is supposed to be an almost drop-in replacement for the previous DrawerLayout.

* Export gesture types (software-mansion#1641)

Exporty types of gesture objects

* Remove leftover set prefix in ForceTouchGesture (software-mansion#1645)

Remove leftover set prefix from setMinForce.

* Add Drag and Drop example with new API (software-mansion#1635)

Add example showcasing drag and drop using new api and Reanimated 2.

Co-authored-by: Dawid Jagieła <dawid.jagiela@ext.chime.com>
Co-authored-by: Jakub Piasecki <jakub.piasecki@swmansion.com>

* Update examples (software-mansion#1660)

Update camera example to use the Exclusive with variable number of arguments.
Update better drawer example to not crash on newer versions of Reanimated.

* Update pan gesture to use the same set of properties as PanGestureHandler (software-mansion#1662)

Move all shared properties of PanGesture and PanGestureHandler to the CommonPanProperties interface. This allows PanGesture to utlize all (non-deprecated) properties available to the PanGestureHandler.
Added PanGesture config methods corresponding to the moved props.
Removed deprecated props from PanGestureHandler.

* Remove animatedGesture prop, use animated gesture automatically (software-mansion#1665)

Remove animatedGesture prop from GestureDetector component and add automatic check whether the gesture callbacks are worklets. If any one of them is a worklet, gesture will be initialized the same way it would be via animatedGesture. If no callback is a worklet, then the gesture will be initialized without using Reanimated.

* Get rid of specifying optionalDependencies in package.json

The optionalDependencies option was causing reanimated to be installed in other projects as indirect dependency because optionals need to be specified at the project scope and not at the dependency scope. As a result projects using pre-released versions would end up with two versions of reanimated installed under node_modules which in turn was causing a number of different issues specifically around reanimated's ConfigHelper functionality.

* Move reanimated to devDependencies

* Add  chat_heads example with new api (software-mansion#1624)

Co-authored-by: Dawid Jagieła <dawid.jagiela@ext.chime.com>
Co-authored-by: Jakub Piasecki <jakub.piasecki@swmansion.com>

* Bottom Sheet example with new API (software-mansion#1637)

Co-authored-by: Dawid Jagieła <dawid.jagiela@ext.chime.com>
Co-authored-by: Jakub Piasecki <jakub.piasecki@swmansion.com>

* Setup development environment

* Rename all .m files to .mm

* Rename onBegan to onBegin (software-mansion#1689)

Rename onBegan to onBegin in order to be more consistent with naming.

* Integrate with Reanimated

* Assign viewTag for RNReanimated eventHash

* Return viewTag in e.target for classic JS callbacks

* Add examples

* Animated with `USE_NATIVE_DRIVER=true` works!

* Remove BetterDrawerLayout component (software-mansion#1690)

Remove BetterDrawerLayoutComponent in order not to force the users into using Reanimated and move to the Example app.

* Update types (software-mansion#1736)

Changes regarding types:

Rename UnwrappedGestureHandlerEvent to GestureUpdateEvent and export it
Rename UnwrappedGestureHandlerStateChangeEvent to GestureStateChangeEvent and export it
export GestureType
change gesture refs type to React.RefObject<GestureType | undefined>
add React.RefObject<React.ComponentType | undefined> to GestureRef not to show error when adding a gesture handler

* Add touch events and manual gesture (software-mansion#1737)

Add GestureTouchEvent containing data about specific touch
Add onTouchesDown, onTouchesMove, onTouchesMove, onTouchesCancelled callbacks to gestures
Add manualActivation prop to continuous gestures
Add ManualGesture
Add GestureStateManager that utilizes Reanimated to allow for synchronous control of gesture state

* Improve bouncing box example

* Improve draggable box example

* Update examples status list

* Update yarn.lock

* Use onBegin instead of onBegan

* Fix example

* Update package.json

* Update yarn.lock

* Build React Native Gesture Handler

* Bring back Gesture Handler

* Ignore old API warning

* Add ultimate example

* Update yarn.lock

* Reset color on gesture fail

* Remove old docs

* Update ultimate example

* Disable auto-workletization

* Fix useNativeDriver

* Somehow it works

* It works part 2

* Use `.toString()` method

* Improve comments

* Mark some methods as never used

* Workaround for buggy native animated module on fast refresh

* Improve comments

* Distinguish event action types on iOS

* Somehow it works on Android

* Update yarn.lock

* Add manual touches example

* Remove unused methods

* Implement `onTouchEvent` on Android

* Refactor RNGestureHandlerModule methods

* Improve naming

* Create Fabric example app

* FabricExample + RNGestureHandlerButton on iOS

* Fix Android build

* Fix GestureHandlerRootView name on Android

* Make it work on both platforms

* Add RNGestureHandlerButton on Android

* Remove button property

* Add switches

* Remove additional config steps required when running Fabric version on Android

* Fix view flattening

* Add UltimateExample

* Fix warning message

* Return when view is nil

* Improve comment in `RNGestureHandlerRootViewCls`

* Fix TypeScript and `findHostInstance_DEPRECATED` import

* Attach to the contentView of RCTViewComponentView when possible

* Add comment before extracting contentView

* Add comment about view flattening on Android

* Use React Native 0.68.0-rc.1

* Setup navigation in FabricExample

* Remove auto-wrapping with non-collapsable view, replaced with error

* Remove imports

* Improve FabricExample

* Move GestureHandlerRootView to App.tsx

* Update build.gradle

* Add ComponentsExample, fix component name

* Remove unused prop

* Fix TS types

* Restore Android

* Introduce ActionType enum in TypeScript

* Introduce ActionType in Kotlin

* Introduce ActionType on iOS

* Paper and Fabric interoperability (part 1)

* Paper and Fabric interoperability (part 2)

* Rename .mm files back to .m

* Restore old example app

* Rename .mm files back to .m

* Update package.json

* Init FabricExample

* Rename some .m files to .mm

* Send direct events for old API on Paper on iOS

* Fix events on iOS

* Android with Fabric enabled works!

* Basic Fabric & Paper on Android

* Fix Fabric

* Remove comment

* Add comment

* Fix comment

* Restore comment

* Fabric & Paper on Android 2

* Update package

* Move codegen'en files to Paper srcDirs

* Update Android.mk

* Update README.md

* Update Android.mk

* Import fireEvent conditionally

* Add MBFingerTipWindow to FabricExample

* Update Android.mk

* Minor improvements

* Use original NDK version

* Update README

* Remove react-native-codegen from library dependencies

* Update yarn.lock

* Fix typos in build.gradle

* Add using namespace react in cpp-adapter.cpp

* Add MBFingerTipWindow to FabricExample

* Update RNGestureHandlerModule.mm

* Remove `*` from imports

* Remove unnecessary files

* Import `utils.tsx` once.

* Enable `RCT_NEW_ARCH_ENABLED` by default in Podfile

* Add TODO note about `ENABLE_FABRIC` flag

* Add icons to FabricExample

* Ignore flow `js` files for codegen on CI

* Move eslintIgnore to package.json

* Update babel.config

* Use `isFabric` function instead of constant

* Add comment about codegen files in android repo

* Improve FabricExample app

* Improve comments

* Minor improvements

* Fix typo in FabricExample

* Fix web

* Update dependencies in FabricExample

* Reformat FabricExample

* Add GestureCompositionScreen

* Change screen animation

* Minor improvements in FabricExample

* Update README.md

Co-authored-by: Wojciech Lewicki <wojciech.lewicki@swmansion.com>

* Add comment about getShadowNodeFromRef on web

* Add `android/src/main/jni/` to `package.json`

* Revert "Import fireEvent conditionally"

This reverts commit 1a760e4.

* Revert changes to utils

* Sort imports

* Update RNGestureHandlerComponentsRegistry.cpp

* Improve RNGestureHandler.podspec

* Change header title

* Fix gesture handler attaching too early sometimes

* Update Podfile.lock

* Update comments in methods for sending events

* Remove excluded archs

* Update .prettierrc

* Revert "Add MBFingerTipWindow to FabricExample"

This reverts commit 51514c2.

* Remove import

* Restore `R.` in place of `android.R`

* `android.R` is fine

* Fix typo in ViewFlatteningScreen.tsx

Co-authored-by: Kacper Kapuściak <39658211+kacperkapusciak@users.noreply.github.com>

* Remove unused argument in GestureCompositionScreen.tsx

Co-authored-by: Kacper Kapuściak <39658211+kacperkapusciak@users.noreply.github.com>

* Add exception

* Fix attach gesture handler delay caused by console.error

* Use `tagMessage`

* Bump FabricExample to 0.68.0-rc.2

* Remove count from view flattening demo

* Set correct library name

* Remove super invalidate call

* Use SoLoader instead of System

* Remove TODO from OnLoad.cpp

* Use `RNGestureHandlerActionType` instead of `NSNumber *`

* Fix custom events on React Native 0.63.4

* Bump react-native-screens to 3.13.0 in FabricExample

* Revert "Restore `R.` in place of `android.R`"

This reverts commit aadd131.

* Restore original Podfile in example app

* Remove console.logs

Co-authored-by: Jakub Piasecki <jakub.piasecki@swmansion.com>
Co-authored-by: Jakub Gonet <jakub.gonet@swmansion.com>
Co-authored-by: Dawid Jagieła <dawid0000@gmail.com>
Co-authored-by: Dawid Jagieła <dawid.jagiela@ext.chime.com>
Co-authored-by: Krzysztof Magiera <krzys@swmansion.com>
Co-authored-by: Wojciech Lewicki <wojciech.lewicki@swmansion.com>
Co-authored-by: Kacper Kapuściak <39658211+kacperkapusciak@users.noreply.github.com>
* Copy `ScaleGestureDetector` from AOSP

* Update ScaleGestureDetector and use it

* Delete NOTICE

* Update ScaleGestureDetector.java

Co-authored-by: Krzysztof Magiera <krzys@swmansion.com>
* Bump version

* Add 2.3.0 version to docs
…ion#1904)

- Fix link to the Example app section that was removed in f36babf
- Fix broken links to the Example app on GitHub
Adds section about Fabric in the installation page in the docs.
…ware-mansion#1901)

Include `style={{ flex: 1 }}` in example for `GestureHandlerRootView`.
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
@fluiddot fluiddot marked this pull request as ready for review April 8, 2022 11:23
@fluiddot fluiddot requested a review from geriux April 8, 2022 11:23
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 fluiddot merged commit 80bc5cf into trunk May 25, 2022
@fluiddot fluiddot deleted the upstream-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.