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

New Architecture issue: Trying to call native module before CatalystInstance has been set #516

Open
robin-pham opened this issue Aug 5, 2024 · 6 comments
Labels

Comments

@robin-pham
Copy link

Just wanted to point out that the APIs that are used in this library are deprecated with the new arch and results in errors. Raised it up in the corresponding new architecture discussion thread: reactwg/react-native-new-architecture#201 (comment)

Exception in native call
java.lang.IllegalStateException: Trying to call native module before CatalystInstance has been set!
	at com.facebook.react.bridge.ReactContext.raiseCatalystInstanceMissingException(ReactContext.java:154)
	at com.facebook.react.bridge.ReactContext.getNativeModule(ReactContext.java:207)
	at com.th3rdwave.safeareacontext.SafeAreaView.updateInsets(SafeAreaView.kt:50)
	at com.th3rdwave.safeareacontext.SafeAreaView.maybeUpdateInsets(SafeAreaView.kt:118)
	at com.th3rdwave.safeareacontext.SafeAreaView.onAttachedToWindow(SafeAreaView.kt:139)
	at android.view.View.dispatchAttachedToWindow(View.java:21980)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3490)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.addViewInner(ViewGroup.java:5318)
	at android.view.ViewGroup.addView(ViewGroup.java:5104)
	at android.view.ViewGroup.addView(ViewGroup.java:5044)
	at androidx.fragment.app.FragmentStateManager.addViewToContainer(FragmentStateManager.java:833)
	at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:523)
	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2106)
	at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1971)
	at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:311)
	at com.swmansion.rnscreens.ScreenContainer.onUpdate(ScreenContainer.kt:393)
	at com.swmansion.rnscreens.ScreenContainer.performUpdates(ScreenContainer.kt:338)
	at com.swmansion.rnscreens.ScreenContainer.performUpdatesNow(ScreenContainer.kt:330)
	at com.swmansion.rnscreens.ScreenContainer.notifyChildUpdate(ScreenContainer.kt:83)
	at com.swmansion.rnscreens.Screen.setActivityState(Screen.kt:138)
	at com.swmansion.rnscreens.ScreenViewManager.setActivityState(ScreenViewManager.kt:63)
	at com.swmansion.rnscreens.ScreenViewManager.setActivityState(ScreenViewManager.kt:37)
	at com.swmansion.rnscreens.ScreenViewManager.setActivityState(ScreenViewManager.kt:24)
	at com.facebook.react.viewmanagers.RNSScreenManagerDelegate.setProperty(RNSScreenManagerDelegate.java:96)
	at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:46)
	at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:77)
	at com.facebook.react.fabric.mounting.SurfaceMountingManager.updateProps(SurfaceMountingManager.java:869)
	at com.facebook.react.fabric.mounting.mountitems.IntBufferBatchMountItem.execute(IntBufferBatchMountItem.java:140)
	at com.facebook.react.fabric.mounting.MountItemDispatcher.executeOrEnqueue(MountItemDispatcher.java:363)
	at com.facebook.react.fabric.mounting.MountItemDispatcher.dispatchMountItems(MountItemDispatcher.java:271)
	at com.facebook.react.fabric.mounting.MountItemDispatcher.tryDispatchMountItems(MountItemDispatcher.java:107)
	at com.facebook.react.fabric.FabricUIManager$DispatchUIFrameCallback.doFrameGuarded(FabricUIManager.java:1321)
	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)
@hosseinmd
Copy link

I have exact same issue in new arch

@janicduplessis
Copy link
Collaborator

Which version of react-native are you using?

@robin-pham
Copy link
Author

0.74.3 for me

@robin-pham
Copy link
Author

@janicduplessis A react native dev replied in the discussion thread just fyi:

reactwg/react-native-new-architecture#201 (reply in thread)

@raphael-liu
Copy link

0.74.3 for me

+1

@laigaobacc
Copy link

I have exact same issue in new arch,hoping the author can solve it quickly

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

No branches or pull requests

6 participants