react-native-fast-image icon indicating copy to clipboard operation
react-native-fast-image copied to clipboard

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

Open AndrewMatsiuk opened this issue 1 year ago • 9 comments

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"

AndrewMatsiuk avatar Jul 30 '24 11:07 AndrewMatsiuk

same error here

thiagomachado1998 avatar Jul 30 '24 12:07 thiagomachado1998

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.

AndrewMatsiuk avatar Jul 30 '24 12:07 AndrewMatsiuk

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

deepanshushuklad11 avatar Jul 31 '24 19:07 deepanshushuklad11

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.

AndrewMatsiuk avatar Jul 31 '24 22:07 AndrewMatsiuk

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

thiagomachado1998 avatar Jul 31 '24 23:07 thiagomachado1998

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

You can check this: https://github.com/DylanVann/react-native-fast-image/pull/1032, but I think this lib doesn't work on the new building version

AndrewMatsiuk avatar Jul 31 '24 23:07 AndrewMatsiuk

Working on it

deepanshushuklad11 avatar Aug 01 '24 09:08 deepanshushuklad11

hello, I'm also facing the same issue.

khushbujilka-developer avatar Aug 13 '24 12:08 khushbujilka-developer

hello, I'm also facing the same issue.

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

deepanshushuklad11 avatar Aug 13 '24 16:08 deepanshushuklad11