Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Error: Text strings must be rendered within a <Text> component. React-Navigation Library Problem

The Error I am Facing is this:
Error: Text strings must be rendered within a component.

This error is located at:
in EnsureSingleNavigator
in BaseNavigationContainer
in ThemeProvider
in NavigationContainerInner (created by App)
in Provider (created by App)
in App (created by withDevTools(App))
in withDevTools(App)
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
in main(RootComponent), js engine: hermes

Here is my code::
App.tsx

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, View } from "react-native";
import RootNavigator from "./router/RootNavigator";
import { Provider } from "react-redux";
import { store } from "./store/store";
import { NavigationContainer } from "@react-navigation/native";

export default function App() {
  return (
    <Provider store={store}>
      <NavigationContainer>
        <RootNavigator />;
      </NavigationContainer>
    </Provider>
  );
}
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import React from "react";
import Home from "../pages/Home";

export type ParamList = {
  home: undefined;
};
const RootStack = createNativeStackNavigator();

function RootNavigator() {
  return (
    <RootStack.Navigator>
      <RootStack.Screen name="home" component={Home} />
    </RootStack.Navigator>
  );
}

export default RootNavigator;
import React from "react";
import { Text } from "react-native";

function Home() {
  return (
    <Text>Hello</Text>
  );
}

export default Home;

I am using newer version of all libraries.

I want to set navigation without that error

>Solution :

enter image description here

do you see semi colon ";" at the end of your RootNavigator component

it treated as string so it must be in Text in component

remove it and your problem solved

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading