Open dnlsilva opened 1 year ago
@radex Hey, can we please get an answer on this?
JSI still not working on Android with the new arch enable. The only solution that I found to use Watermelon with the new Arch is not implement the JSI config. @GleidsonDaniel
Same here, @notmarinho. @radex any chance you could help us on that?
The solution is to disable the new arch(Fabric only) on Android.
@lucaswitch Thank you. It works here.
Can you explain to me the logic to disable the fabric?
Fabric There is no need to disable it. Works fine with fabric, but you should not do the JSI configuration recommended by the documentation
@notmarinho if i disable the JSI in MainApplication.java, when I try to enable the turbo in sync it does not work.
Can you give me more details?
@ebnersilva I'm not using sync at the moment. Does it work if disable turbo?
To disable fabric on android
gradle.properties
.newArchEnabled
in it.newArchEnabled=false
.@ebnersilva I'm not using sync at the moment. Does it work if disable turbo?
To disable fabric on android
1. Go to the file `gradle.properties`. 2. It should have a variable called `newArchEnabled` in it. 3. Change the value of it to `newArchEnabled=false`.
Make sure to run ./android/gradlew clean and run the build afterwards to changes be effective. Another solution is to disable JSI(On Android) in favor of using Fabric. All RN UI libraries are migrating from previous rendering engine to fabric, we must migrate as soon as possible in favor of keeping our apps stable.
Is there any plans to migrate the library to the new architecture?
With the release of the react native 0.74 we cannot use JSI anymore so, we need turbo to keep using this library on the future. https://reactnative.dev/blog/2024/04/22/release-0.74#other-breaking-changes
To use Turbo Login we need this piece of code in MainApplication.kt:
override fun getJSIModulePackage(): JSIModulePackage? { return JSIModulePackage { reactApplicationContext, jsContext -> val modules = mutableListOf<JSIModuleSpec<*>>() modules.addAll( WatermelonDBJSIPackage().getJSIModules( reactApplicationContext, jsContext ) ) } }
From react native 0.74.2, the method getJSIModulePackage() doesn't exist anymore. It seems this module has to be rewritten using TurboModule. Is there a workaround to use Turbo Login without using getJSIModulePackage() configuration? If not, can we expect a rewrite using TurboModule?
We can make a pull request to add the existing jsi api into a turbo module.
What i know it's that the turbo module automatically creates the cpp ffi bindings( using a flow file) that @radex did by manually on current jsi implementation, see: _https://github.com/Nozbe/WatermelonDB/blob/master/native/android-jsi/src/main/cpp/DatabasePlatformAndroid.cpp and objective c equivalent.
We can achieve the same behavior using at least 50% or more the code that is already written and tested but i think it should be a major version bump.
The documentation is quite outdated in terms of using fabric with android, there is this issue here: https://github.com/Nozbe/WatermelonDB/issues/1386 however it is also outdated and react native 0.71 does not have this file (
android/app/src/main/java/yourappnamefolder/newarchitecture/MainApplicationReactNativeHost.java
) anymore.Where should I add the files to enable jsi on android?