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

Add jsi support for newer react native versions(old-arch) #1854

Merged
merged 4 commits into from
Nov 29, 2024

Conversation

prathameshmm02
Copy link
Contributor

@prathameshmm02 prathameshmm02 commented Nov 16, 2024

Fixes #1833.

Convert WMDB JSI Module to NativeModule which removes the need of overriding getJSIModulePackage.

This works for bare react native apps with versions 0.74-0.76 and Expo 51 as of now and does not work with Expo 52, bc of autolinking issues, I am looking into that.

@prathameshmm02 prathameshmm02 changed the title add jsi support for newer react native versions(old-arch) Add jsi support for newer react native versions(old-arch) Nov 16, 2024
@radex
Copy link
Collaborator

radex commented Nov 20, 2024

@prathameshmm02 Excellent work. I will need to test it in more detail before I can merge it into mainline, but if this approach works, it clearly seems like it would cause fewer installation troubles.

Is this something that other JSI libraries did as well recently?

Have you tested on relatively old RN versions? I believe the reason why I took the JSIModule approach originally instead of the one you took is that native modules were ran on the wrong thread and the whole thing would crash.

@prathameshmm02
Copy link
Contributor Author

prathameshmm02 commented Nov 20, 2024

Is this something that other JSI libraries did as well recently?

Yeah, react-native-mmkv, reanimated & vision camera all had this approach, as they all use JSI on old arch.

Have you tested on relatively old RN versions?

No, just 74 and 76 as of now, it should work (probably) though.

I believe the reason why I took the JSIModule approach originally instead of the one you took is that native modules were run on the wrong thread and the whole thing would crash.

@ReactMethod(isBlockingSynchronousMethod = true) this makes it work as it's synchronous.

Also, it would be better if installation with Expo 52 with new autolinking would be fixed, as there are a lot of WatermelonDB users using Expo (including me). The issue with autolinking is that android & ios folders of the project are in native folder, though, in my testing this has only caused issues on android, ios works fine.

@prathameshmm02 prathameshmm02 force-pushed the fix/jsi-compatibility branch 2 times, most recently from 4eed838 to c977b2d Compare November 22, 2024 05:59
@radex radex changed the base branch from master to rn074 November 29, 2024 12:38
@radex radex changed the base branch from rn074 to master November 29, 2024 12:38
@radex radex merged commit f5c34eb into Nozbe:master Nov 29, 2024
6 checks passed
@radex
Copy link
Collaborator

radex commented Nov 29, 2024

@prathameshmm02 Thank you, this was helpful!

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.

jsimodule not working in 0.74.3 version
2 participants