从 React Native 和 React Navigation 中的 header 移除后退按钮

Remove back button from header in React Native and React Navigation

尝试了这两种方法,但 none 有效:

options={{
  headerLeft: () => {
     return null}
}}

// method 2
screenOptions={{
   headerLeft: null,
}}

您可以对所有屏幕或其中一个屏幕执行此操作,如下所示:

  <Stack.Navigator
        {/* For all screen inside this Stack Navigator */}
        screenOptions={{
          headerBackVisible: false,
        }}
      >
       
        <Stack.Screen name="Login"
           {/* For login screen inside this Stack Navigator */}
           options={{headerBackVisible:false }}
           component={LoginScreen}
         />
  </Stack.Navigator>