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

Make the library compatible with react-native-reanimated #68

Closed
wants to merge 1 commit into from

Conversation

xseignard
Copy link

Why

Supersede #67

react-native-reanimated is a popular library for react-native to create and drive animations.

See https://docs.swmansion.com/react-native-reanimated/

react-native is running on 2 threads:

  • UI thread for native UI updates
  • JS thread for the react-native code execution

To be able to run simplex-noise on the UI thread with react-native-reanimated we need to workletize the functions.

You can read more here: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#worklet

How

  • Rely on jscodeshift to add "worklet"; directives where needed
  • Rely on react-native and exports fields to distribute specific versions of simplex-noise
  • Customize the build process

Test

Tested on mobile with react-native@0.72.6 and react-native-reanimated@3.6.2

Impacts

  • None, the source code is not affected, the "worklet"; directives are added dynamically at build time

Good to know

Will only work with react-native-reanimated@3.6.2+

@jwagner
Copy link
Owner

jwagner commented Feb 14, 2024

Hey @xseignard , did you get any response from @software-mansion on alternative ways to solve this?

While this PR does not change the code anymore it still adds a lot of dependencies and complexity at build time which will require maintenance. It just doesn't seem right that every library would need to add something like this just to be called.

@xseignard
Copy link
Author

I agree it is kind of over-engineered 😅
I'll try to get some attention on the subject to see if there's a better way.

@jwagner
Copy link
Owner

jwagner commented Mar 4, 2024

Hey @xseignard , I wonder how I should continue with this. If I understood the discussion correctly software-mansion/react-native-reanimated#5669 should resolve this issue. Should we just wait for that to land?

@xseignard
Copy link
Author

Hello 👋
Yes at one point it will solve the current issue.

So I think this PR can be closed.

Thanks for the follow up! 🙏

@xseignard xseignard closed this Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants