Kanwarjeet Singh
Kanwarjeet Singh

Reputation: 162

React Navigation I requireNativeComponent: "RNSScreenStackHeaderConfig"

I just started my new project. After installing react-navigation and using it in my IOS app i got an error Invariant Violation: requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager.. I unable to find out what's the problem.

Here is My navigation code

import React from 'react';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import strings from '../Constants/Strings';
import {Home} from '../Screens';

const Stack = createNativeStackNavigator();

export default MainStack = () => {
  return (
    <Stack.Navigator>
      <Stack.Screen name={strings.navHome} component={Home} />
    </Stack.Navigator>
  );
};
import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import MainStack from './MainStack';

const Routes = () => {
  return (
    <NavigationContainer>
      <MainStack />
    </NavigationContainer>
  );
};

export default Routes;

Anyone can tell me what's the probem? I never got error like this before

Upvotes: 4

Views: 6734

Answers (5)

M ragab
M ragab

Reputation: 1

if you using expo you must use build development because it need native libiraries ,if not try to rebuild

Upvotes: 0

kjtx
kjtx

Reputation: 1

Installing the pods worked for me!!

npx pod-install

Upvotes: 0

Eduardo Rosado
Eduardo Rosado

Reputation: 323

Previously must have been installed.

@react-navigation/native-stack
react-native-safe-area-context
react-native-screens

Additionally, try clearing the cache and recompiling the app.

watchman watch-del-all && rm -rf node_modules
yarn cache clean && yarn
npx pod-install
yarn start --reset-cache

After that, you can try running the app with:

yarn run ios

Upvotes: 0

林平君
林平君

Reputation: 141

I install @react-navigation/native-stack and react-native-safe-area-context and react-native-screens

but have same error

Invariant Violation: requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager

Upvotes: 2

Thɑliɑ Aquino
Thɑliɑ Aquino

Reputation: 78

If you are using @react-navigation/native-stack, you should install react-native-screens and react-native-safe-area-context too. I believe your error is because you don't have installed react-native-screens

Check the documentation

Upvotes: 6

Related Questions