react-navigation / react-navigation

Routing and navigation for your React Native apps
https://reactnavigation.org
23.3k stars 4.97k forks source link

Invariant Violation: requireNativeComponent: "RNSModalScreen" was not found in the UIManager. #11926

Open ayushthumar opened 1 month ago

ayushthumar commented 1 month ago

Current behavior

Below is my code and I am not using expo, I am using the react-native cli:

import * as React from 'react';
import { Text, View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';

function HomeScreen() {
  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Text>Home!</Text>
    </View>
  );
}

function SettingsScreen() {
  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Text>Settings!</Text>
    </View>
  );
}

const Tab = createBottomTabNavigator();

export default function App() {
  return (
    <NavigationContainer>
      <Tab.Navigator>
        <Tab.Screen name="Home" component={HomeScreen} />
        <Tab.Screen name="Settings" component={SettingsScreen} />
      </Tab.Navigator>
    </NavigationContainer>
  );
}

This is the error I am getting

Invariant Violation: requireNativeComponent: "RNSModalScreen" was not found in the UIManager.

This error is located at: in RNSModalScreen in Unknown (created by InnerScreen) in Suspender (created by Freeze) in Suspense (created by Freeze) in Freeze (created by DelayedFreeze) in DelayedFreeze (created by InnerScreen) in InnerScreen (created by Screen) in Screen (created by MaybeScreen) in MaybeScreen (created by BottomTabView) in RNSScreenNavigationContainer (created by ScreenContainer) in ScreenContainer (created by MaybeScreenContainer) in MaybeScreenContainer (created by BottomTabView) in RNCSafeAreaProvider (created by SafeAreaProvider) in SafeAreaProvider (created by SafeAreaProviderCompat) in SafeAreaProviderCompat (created by BottomTabView) in BottomTabView (created by BottomTabNavigator) in PreventRemoveProvider (created by NavigationContent) in NavigationContent in Unknown (created by BottomTabNavigator) in BottomTabNavigator (created by App) in EnsureSingleNavigator in BaseNavigationContainer in ThemeProvider in NavigationContainerInner (created by App) in App in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer in appUI(RootComponent), js engine: hermes

Screenshot

Screenshot 2024-04-03 at 12 28 26 PM

Expected behavior

What I want is

image

Reproduction

https://reactnavigation.org/docs/tab-based-navigation

Platform

Packages

Environment

package version
@react-navigation/native 6.1.17
@react-navigation/bottom-tabs 6.5.20
react-native 0.73.6
node 18.0.0
npm or yarn 10.5.0
github-actions[bot] commented 1 month ago

Hey @ayushthumar! Thanks for opening the issue. It seems that the issue doesn't contain a link to a repro.

The best way to get attention to your issue is to provide an easy way for a developer to reproduce the issue.

You can provide a repro using any of the following:

github-actions[bot] commented 1 month ago

Couldn't find version numbers for the following packages in the issue:

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

Dhruv-88 commented 1 month ago

hello @ayushthumar can you share how you resolve this issue please ?

github-actions[bot] commented 1 month ago

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.

ayushthumar commented 1 month ago

hello @ayushthumar can you share how you resolve this issue please ?

Hello @Dhruv-88, I just deleted the build file in ios folder and then rebuild it, and also I stopped the server at port 8081 and restarted it ! Let me know if it works for you or not !

WyattBensman commented 1 month ago

I am using Expo, and I am receiving the same error with the same code you provided. Any insight on how to correct this? I saw you mentioned deleting the build file in the ios folder, where exactly is this? Any other tips?

ayushthumar commented 1 month ago

I am using Expo, and I am receiving the same error with the same code you provided. Any insight on how to correct this? I saw you mentioned deleting the build file in the ios folder, where exactly is this? Any other tips?

Screenshot 2024-04-05 at 10 34 33 AM

In your home directory there will be ios folder, go in that folder and run command rm -r build and then again run the app in simulator or your device that will automatically create new latest build file.

ayushthumar commented 1 month ago

I did not found any other valid and sensible solution for this issue, I am assuming that this issue came with the new version. @brentvatne @skevy @satya164 can you please help us on this.

netshade commented 1 month ago

I think you may have accidentally tagged me on this issue, I'm not able to assist with this.

WyattBensman commented 1 month ago

I am using Expo, and I am receiving the same error with the same code you provided. Any insight on how to correct this? I saw you mentioned deleting the build file in the ios folder, where exactly is this? Any other tips?

Screenshot 2024-04-05 at 10 34 33 AM

In your home directory there will be ios folder, go in that folder and run command rm -r build and then again run the app in simulator or your device that will automatically create new latest build file.

I sadly don't have the same file structure. I will continue to trouble shoot & hopefully find a solution.

aminesebastian commented 1 month ago

Just want to report I'm experiencing this too on Expo. I was able to resolve it by downgrading react-native-screens to 3.29.0:

npm install react-native-screens@~3.29.0
jeremiasr commented 1 month ago

Thanks! aminesebastian it's work!

gulsher7 commented 1 month ago

same error facing . Tried all methods but now working

Petercopter commented 1 month ago

Same error as OP here. Another similarity is that it's the Tabs component

Generalchrist commented 1 month ago

I'm encountering the same issue as described in this thread. However, I'm using createStackNavigator as outlined in the documentation.

While the application runs smoothly on the Android emulator, it throws the following error and gets stuck at the splash screen when launched on my iPhone 7:

ERROR Invariant Violation: requireNativeComponent: "RNSModalScreen" was not found in the UIManager.

EDIT: I solved it by this command: npx expo install react-native-screens react-native-safe-area-context I don't use these packages but somehow something needs them.

abisalde commented 4 weeks ago

Just want to report I'm experiencing this too on Expo. I was able to resolve it by downgrading react-native-screens to 3.29.0:

npm install react-native-screens@~3.29.0

This works

protonforest commented 3 weeks ago

yeah theres definetly something wrong with the last 3.30 version

codegabk commented 1 week ago

Is there a workaround without downgrading from 3.30 to 3.29 ?

ayushthumar commented 1 week ago

Is there a workaround without downgrading from 3.30 to 3.29 ?

Till now I have not found any other way to get the work done with 3.30 !