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

Tried to access a JS module before the React instance was fully set up. #1041

Open
AndrewMatsiuk opened this issue Jul 30, 2024 · 9 comments · Fixed by dream-sports-labs/react-native-fast-image#16
Labels

Comments

@AndrewMatsiuk
Copy link

Hi everyone,

I've been trying to fix this issue for a week, and it's breaking my brain ((

Has anyone else encountered this problem?

Exception in native call
java.lang.IllegalStateException: Tried to access a JS module before the React instance was fully set up. Calls to ReactContext#getJSModule should only happen once initialize() has been called on your native module.
at com.facebook.react.bridge.ReactContext.getJSModule(ReactContext.java:180)
at com.dylanvann.fastimage.FastImageViewWithUrl.onAfterUpdate(FastImageViewWithUrl.java:132)
at com.dylanvann.fastimage.FastImageViewManager.onAfterUpdateTransaction(FastImageViewManager.java:181)
at com.dylanvann.fastimage.FastImageViewManager.onAfterUpdateTransaction(FastImageViewManager.java:33)
at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:81)
at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:181)
at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:108)
at com.facebook.react.fabric.mounting.SurfaceMountingManager.createViewUnsafe(SurfaceMountingManager.java:843)
at com.facebook.react.fabric.mounting.SurfaceMountingManager.preallocateView(SurfaceMountingManager.java:1212)
at com.facebook.react.fabric.mounting.mountitems.PreAllocateViewMountItem.execute(PreAllocateViewMountItem.java:67)
at com.facebook.react.fabric.mounting.MountItemDispatcher.executeOrEnqueue(MountItemDispatcher.java:363)
at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchPreMountItems(MountItemDispatcher.java:342)
at com.facebook.react.fabric.FabricUIManager$DispatchUIFrameCallback.doFrameGuarded(FabricUIManager.java:1320)
at com.facebook.react.fabric.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:32)
at com.facebook.react.modules.core.ReactChoreographer$1.doFrame(ReactChoreographer.java:89)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1337)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1348)
at android.view.Choreographer.doCallbacks(Choreographer.java:952)
at android.view.Choreographer.doFrame(Choreographer.java:878)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1322)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

Знімок екрана 2024-07-30 о 14 40 07
This problem only in android version , ios work perfect.

React Native version: 0.74.2
React version: 18.2.0
React Native Fast Image version: ^8.6.8
my build.gradle:

buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 23
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.22"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
}
}

apply plugin: "com.facebook.react.rootproject"

@thiagomachado1998
Copy link

same error here

@AndrewMatsiuk
Copy link
Author

same error here

My assumption is that before React Native version 0.73, there were MainApplication.java and MainActivity.java, but from version 0.73, everything moved to Kotlin with MainApplication.kt and MainActivity.kt.

@deepanshushuklad11
Copy link

Hello , Please try @d11/react-native-fast-image ,let me know if issue persist.

@AndrewMatsiuk
Copy link
Author

Hello , Please try @d11/react-native-fast-image ,let me know if issue persist.

The same, plus on the new versions of React Native, some other libraries don't work yet, so I just created a new project on an older version of React Native. I chose 0.72.11, and everything works good.

@thiagomachado1998
Copy link

thiagomachado1998 commented Jul 31, 2024

This problem happened to me after activating the new architecture in version 0.74.3

@AndrewMatsiuk
Copy link
Author

This problem happened to me after activating the new architecture in version 0.74.3

You can check this: #1032, but I think this lib doesn't work on the new building version

@deepanshushuklad11
Copy link

Working on it

@khushbujilka-developer
Copy link

hello, I'm also facing the same issue.

@deepanshushuklad11
Copy link

hello, I'm also facing the same issue.

@khushbujilka-developer Please use @d11/react-native-fast-image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants