Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy Directions enum to JS #1366

Merged
merged 7 commits into from
Feb 16, 2021
Merged

Copy Directions enum to JS #1366

merged 7 commits into from
Feb 16, 2021

Conversation

jakub-gonet
Copy link
Member

@jakub-gonet jakub-gonet commented Feb 16, 2021

Description

Fixes #1081.
Fixes #851.
Fixes #1324.

A common problem when importing RNGH is not finding native modules when running on not-yet-supported platforms like React Native for iOS or React Native for Windows.

This PR changes three things:

  • Copies Directions enum to JS and makes it a named export
  • Adds an error message when the RNGH native module is not available
  • Removes Directions from the RNGH Native Module type

Moving Directions into JS allows using it directly in tests. Also, State (which is defined in the Native Module, too) was already copied to JS.

Please note that importing mappings from native modules doesn't incur Bridge roundtrips, this is merely for tests and other platforms' convenience.

Test plan

  • Tested on the Example app

@jakub-gonet jakub-gonet self-assigned this Feb 16, 2021
@jakub-gonet jakub-gonet requested a review from kmagiera February 16, 2021 10:41
@jakub-gonet jakub-gonet marked this pull request as ready for review February 16, 2021 12:14
Copy link
Member

@kmagiera kmagiera left a comment

Choose a reason for hiding this comment

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

Looks good, maybe put a link to installation instruction instead of pointing people to the issues page

@jakub-gonet jakub-gonet merged commit 231103a into master Feb 16, 2021
@jakub-gonet jakub-gonet deleted the @kuba/move-directions-to-js branch February 16, 2021 18:09
braincore pushed a commit to braincore/react-native-gesture-handler that referenced this pull request Mar 4, 2021
A common problem when importing RNGH is not finding native modules when running on not-yet-supported platforms like React Native for iOS or React Native for Windows. 

Moving Directions into JS allows using it directly in tests. Also, State (which is defined in the Native Module, too) was already copied to JS.

Please note that importing mappings from native modules doesn't incur Bridge roundtrips, this is merely for tests and other platforms' convenience.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants