From 7ea02bb30f4f11ace4cfa7e01a3be239dfedefab Mon Sep 17 00:00:00 2001 From: keplyx Date: Tue, 4 Feb 2020 10:50:51 +0100 Subject: [PATCH] Fixed back button not working on some cases --- components/CustomHeader.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/CustomHeader.js b/components/CustomHeader.js index 091f6f3..1c12564 100644 --- a/components/CustomHeader.js +++ b/components/CustomHeader.js @@ -8,6 +8,7 @@ import Touchable from 'react-native-platform-touchable'; import ThemeManager from "../utils/ThemeManager"; import CustomMaterialIcon from "./CustomMaterialIcon"; import i18n from "i18n-js"; +import { NavigationActions } from 'react-navigation'; type Props = { hasBackButton: boolean, @@ -75,10 +76,13 @@ export default class CustomHeader extends React.Component { button = this.props.navigation.goBack()}> + onPress={() => { + const backAction = NavigationActions.back(); + this.props.navigation.dispatch(backAction); + }}> + icon={Platform.OS === 'chevron-left' ? "" : "arrow-left"}/> ; else button = this.props.leftButton;