I have an issue in Stack Navigator Title because I want the title in Center of the Screen but the output is shown in the left side so please help me to change as a center format
I attached the screenshot of my Issue
import {createNativeStackNavigator} from '@react-navigation/native-stack'
import HomeScreen from '../screens/HomeScreen';
import RestaurantDetailsScreen from '../screens/RestaurantDetails'
import DishDetaileScreen from '../screens/DishDetailsScreen';
import Busket from '../screens/Busket';
import OrderScreen from '../screens/OrderScreen';
import OrderDetails from '../screens/OrderDetails';
const Stack = createNativeStackNavigator();
const RootNavigator = () => {
return(
<Stack.Navigator initialRouteName="Restaurant">
<Stack.Screen name="Home" component={HomeScreen}/>
{/* <Stack.Screen
name="Restaurant"
component={RestaurantDetailsScreen}
options={{headerShown: false}}/> */}
</Stack.Navigator>
)
}
export default RootNavigator
I insert the stack navigator on my screen but the title shown on the screen is left side but I want this as the Center
2
Answers
You can add
style
like below example,Just can also use
headerTitleAlign: 'center'
in your Stack.Screen component.