mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-05-27 09:04:44 +08:00
fix: check if we can go baack before dispatching pop
This commit is contained in:
@@ -55,11 +55,14 @@ export default React.memo(function Header(props: StackHeaderProps) {
|
||||
}
|
||||
onGoBack={
|
||||
previous
|
||||
? () =>
|
||||
navigation.dispatch({
|
||||
...StackActions.pop(),
|
||||
source: scene.route.key,
|
||||
})
|
||||
? () => {
|
||||
if (navigation.canGoBack()) {
|
||||
navigation.dispatch({
|
||||
...StackActions.pop(),
|
||||
source: scene.route.key,
|
||||
});
|
||||
}
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
styleInterpolator={styleInterpolator}
|
||||
|
||||
Reference in New Issue
Block a user