How do I make headerLargeTitle appear as large title when the component is a flat list

Viewed 1764

I have a FlatList component and I want the title to be large. I defined the navigator as follows

export const SamplerStackNavigator = () => (
  <Stack.Navigator
    screenOptions={{
      headerLargeTitle: true,
    }}
  >
    <Stack.Screen name="Flat List" options={{}} component={TheList} />
  </Stack.Navigator>
);

However, it just shows the small header. I can scroll down manually to make the large header appear, but I want to make it appear large by default.

https://snack.expo.dev/@trajano/multi-tab-navigation-with-refresh

On the "Home" tab I have

enter image description here

When I switch to the other tab (the header is small by default)

enter image description here

You can pull it down and it will render to the size I want.

enter image description here

1 Answers

Edit: OP is using native stack & not stack navigation from react-navigation.

You can use https://github.com/software-mansion/react-native-screens/tree/master/native-stack#headertitlestyle property to style.

Supported style properties are

  • fontFamily
  • fontSize
  • fontWeight
  • color

The easiest solution that I can give is using the prop headerTitleStyle if you are using the built-in header.

https://reactnavigation.org/docs/stack-navigator/#headertitlestyle

For custom, you can build your own element and style according to your needs.

Check out the live snack demo https://snack.expo.dev/@raajnadar/custom-navigation-title

Related