fix: check if we can go baack before dispatching pop

This commit is contained in:
Satyajit Sahoo
2020-02-12 13:17:08 +01:00
parent 030c63c89f
commit 6c9447a38c

View File

@@ -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}