Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the back button in the header react native

Tags:

react-native

I want to remove the button back, but leave the header.

enter image description here

My component is as follows. I want to leave the title, and I don’t need the back button.

import React from 'react';
import { View } from 'react-native';


export const TrucksScreen = () => {
    return (
        <View>
           ....
        </View>
    );
});

TrucksScreen.navigationOptions = {
    headerTitle: 'Trucks Screen',
};

How can I remove the button back?

like image 496
MegaRoks Avatar asked Oct 23 '25 14:10

MegaRoks


1 Answers

Using headerLeft: null will be deprecated in future versions.

Instead use a function like so :

TrucksScreen.navigationOptions = {
    headerTitle: 'Trucks Screen',
    headerLeft: () => {
      return null;
    },
};

Cheers !

like image 167
michael_vons Avatar answered Oct 27 '25 01:10

michael_vons



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!