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
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 :
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
