how to go back a navigation in react native code example
Example 1: go back button react native
import * as React from 'react';
import { Button } from 'react-native';
import { useNavigation } from '@react-navigation/native';
function MyBackButton() {
const navigation = useNavigation();
return (
<Button
title="Back"
onPress={() => {
navigation.goBack();
}}
/>
);
}
Example 2: go back react native navigation
onPress={() => { this.props.navigation.goBack()}}