react-native-unity
react-native-unity copied to clipboard
"RNSScreenStackHeaderConfig" was not found in the UIManager.
Hi, I am trying to run the example using Expo but I get the error Invariant Violation: requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager..
Steps to reproduce
- Create a new Expo project
expo init unity-test - Install example dependencies
yarn add @azesmway/react-native-unity @react-navigation/native-stack react-navigation/native - Duplicate folders
android,ios, andUnity - Duplicate
App.js,Unity.jsandMain.js - Run the project using
yarn start - Access the app using Expo Go
Full trace:
Invariant Violation: requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager.
This error is located at:
in RNSScreenStackHeaderConfig (created by HeaderConfig)
in HeaderConfig (created by SceneView)
in RNSScreen (created by AnimatedComponent)
in AnimatedComponent
in AnimatedComponentWrapper (created by Screen)
in MaybeFreeze (created by Screen)
in Screen (created by SceneView)
in SceneView (created by NativeStackViewInner)
in RNSScreenStack (created by ScreenStack)
in ScreenStack (created by NativeStackViewInner)
in NativeStackViewInner (created by NativeStackView)
in RNCSafeAreaProvider (created by SafeAreaProvider)
in SafeAreaProvider (created by SafeAreaInsetsContext)
in SafeAreaProviderCompat (created by NativeStackView)
in NativeStackView (created by NativeStackNavigator)
in Unknown (created by NativeStackNavigator)
in NativeStackNavigator (created by App)
in EnsureSingleNavigator
in BaseNavigationContainer
in ThemeProvider
in NavigationContainerInner (created by App)
in App (created by ExpoRoot)
in ExpoRoot
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
Stack trace:
node_modules/react-native/Libraries/LogBox/LogBox.js:149:8 in registerError
node_modules/react-native/Libraries/LogBox/LogBox.js:60:8 in errorImpl
node_modules/react-native/Libraries/LogBox/LogBox.js:34:4 in console.error
node_modules/expo/build/environment/react-native-logs.fx.js:27:4 in error
node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0
node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
node_modules/regenerator-runtime/runtime.js:294:29 in invoke
node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
node_modules/regenerator-runtime/runtime.js:155:27 in invoke
node_modules/regenerator-runtime/runtime.js:165:18 in PromiseImpl.resolve.then$argument_0
node_modules/react-native/node_modules/promise/setimmediate/core.js:37:13 in tryCallOne
node_modules/react-native/node_modules/promise/setimmediate/core.js:123:24 in setImmediate$argument_0
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:123:14 in _callTimer
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:177:14 in _callImmediatesPass
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:437:30 in callImmediates
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:388:6 in __callImmediates
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:132:6 in __guard$argument_0
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:365:10 in __guard
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:131:4 in flushedQueue
[native code]:null in flushedQueue
[native code]:null in invokeCallbackAndReturnFlushedQueue
[ ...](http://localhost:19002/#)
I didn't check the work in expo maybe you can find a solution in google search
You are completly right, I found the solution pretty easily.
I have the same problem with ReactNativeUnityView
Invariant Violation: requireNativeComponent: "ReactNativeUnityView" was not found in the UIManager.
This error is located at:
in ReactNativeUnityView (created by UnityView)
in UnityView (created by Unity)
in Unity (created by SceneView)
in StaticContainer
in EnsureSingleNavigator (created by SceneView)
in SceneView (created by SceneView)
in RCTView (created by View)
in View (created by DebugContainer)
in DebugContainer (created by MaybeNestedStack)
in MaybeNestedStack (created by SceneView)
in RNSScreen (created by AnimatedComponent)
in AnimatedComponent
in AnimatedComponentWrapper (created by Screen)
in MaybeFreeze (created by Screen)
in Screen (created by SceneView)
in SceneView (created by NativeStackViewInner)
in RNSScreenStack (created by ScreenStack)
in ScreenStack (created by NativeStackViewInner)
in NativeStackViewInner (created by NativeStackView)
in RNCSafeAreaProvider (created by SafeAreaProvider)
in SafeAreaProvider (created by SafeAreaInsetsContext)
in SafeAreaProviderCompat (created by NativeStackView)
in NativeStackView (created by NativeStackNavigator)
in Unknown (created by NativeStackNavigator)
in NativeStackNavigator (created by App)
in EnsureSingleNavigator
in BaseNavigationContainer
in ThemeProvider
in NavigationContainerInner (created by App)
in App (created by ExpoRoot)
in ExpoRoot
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
Stack trace:
node_modules/react-native/Libraries/LogBox/LogBox.js:149:8 in registerError
node_modules/react-native/Libraries/LogBox/LogBox.js:60:8 in errorImpl
node_modules/react-native/Libraries/LogBox/LogBox.js:34:4 in console.error
node_modules/expo/build/environment/react-native-logs.fx.js:27:4 in error
node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0
node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
node_modules/regenerator-runtime/runtime.js:294:29 in invoke
node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
node_modules/regenerator-runtime/runtime.js:155:27 in invoke
node_modules/regenerator-runtime/runtime.js:165:18 in PromiseImpl.resolve.then$argument_0
node_modules/react-native/node_modules/promise/setimmediate/core.js:37:13 in tryCallOne
node_modules/react-native/node_modules/promise/setimmediate/core.js:123:24 in setImmediate$argument_0
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:123:14 in _callTimer
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:177:14 in _callImmediatesPass
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:437:30 in callImmediates
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:388:6 in __callImmediates
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:132:6 in __guard$argument_0
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:365:10 in __guard
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:131:4 in flushedQueue
[native code]:null in flushedQueue
[native code]:null in invokeCallbackAndReturnFlushedQueue
I think you need to somehow configure the expo to work with native libraries
I got the exact same problem with a blank react-native project.
you can use my example in folder - example
Hi @kerwanp I just try to work in expo with this plugin. I have same problems. Do you have any progress it? By the way, the plugin works fine with example project.
If you use only Expo Go, then the plugin will not work, since it uses the native part of iOS. You can try to study this documentation to make a native project on expo
https://docs.expo.dev/workflow/customizing/
Thank you for comment. I agree with you. If I start new project, I can develop without Expo Go. Unfortunately, I just want to use this plugin with exist project. I think it is impossible. I will find other way. Anyway, this plugin is really good starting point for me.
Ah! I totally miss understood. You mean I can change Expo Go project to make a native project on Expo?! Wow~ It's really sounds good. I will try it. Thanks again~!
For what it's worth, I had a similar error (not using Expo) and it was easily solved by simply running cd ios && pod install && cd .. from the root directory.
I had simply forgotten to install the required CocoaPods, and the error went away once I did.
Anybody figure out how to get this to work with Expo Go? or how to create a native project from expo go that this will work with?
Found a solution and figured I'd drop it here. First, run npx expo run:android or npx expo run:ios to generate the appropriate Android and ios folders. Then, do all the steps mentioned in the README after exporting the Unity project into the proper folder(s). Then, all you have to do is create a file named local.properties within the React Native Android folder and specify the location of the Android Studio sdk and ndk
sdk.dir = %LOCALAPPDATA%\\Android\\Sdk
ndk.dir = %LOCALAPPDATA%\\Android\\Sdk\\ndk\\<yourUnityNdkVersion>
Finally, run npx expo run:android or npx expo run:ios and it should be working.
Make sure you have the same minSdkVersion, targetSdkVersion, and ndk version within the React Native project as the Unity project or you'll run into errors and need to change the React Native versions to match Unity. If not already installed, install the Unity SDK and NDK into Android studio.
Hello,
Trying to recreate the example from scratch, I ran into the same issue (not using Expo).
I had to install two dependencies (https://stackoverflow.com/a/71546834): npm install react-native-screens react-native-safe-area-context then cd ios && pod install && cd .. did the trick!