Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to hide back button in React-navigation/react-native

I would like to hide the Back button in the top-left corner, but I don't have any idea how to do it with react-navigation or react-native.

Just tried to use static navigationOptions = { header: null } but the < Back button was still alive.

I was using Modal and it works, but I want to know how to hide < Back button without using Modal.

Thank you in advance!

enter image description here

like image 850
Cloie Park Avatar asked Jan 27 '23 18:01

Cloie Park


1 Answers

Using headerLeft: () => <></> works great in iOS, but in Android was still displaying the default back button.

I was able to hide it by adding the headerBackVisible: false on the screenOptions of the Stack Navigator or you could include it on the options for every Stack Screen.

More info at https://reactnavigation.org/docs/native-stack-navigator/#headerbackvisible

like image 82
Reymundo Tenorio Quiroz Avatar answered Jan 29 '23 20:01

Reymundo Tenorio Quiroz