Skip to main content

Header buttons

Now that we know how to customize the look of our headers, let's make them interactive!

Adding a button to the header

The most common way to interact with a header is by tapping a button to the left or right of the title. Let's add a button to the right side of the header:

const MyStack = createNativeStackNavigator({
screens: {
Home: {
screen: HomeScreen,
options: {
headerRight: () => (
<Button onPress={() => alert('This is a button!')}>Info</Button>
),
},
},
},
});