Browse Source

Fixed back button not working on some cases

keplyx 4 years ago
parent
commit
7ea02bb30f
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      components/CustomHeader.js

+ 6
- 2
components/CustomHeader.js View File

@@ -8,6 +8,7 @@ import Touchable from 'react-native-platform-touchable';
8 8
 import ThemeManager from "../utils/ThemeManager";
9 9
 import CustomMaterialIcon from "./CustomMaterialIcon";
10 10
 import i18n from "i18n-js";
11
+import { NavigationActions } from 'react-navigation';
11 12
 
12 13
 type Props = {
13 14
     hasBackButton: boolean,
@@ -75,10 +76,13 @@ export default class CustomHeader extends React.Component<Props> {
75 76
             button =
76 77
                 <Touchable
77 78
                     style={{padding: 6}}
78
-                    onPress={() => this.props.navigation.goBack()}>
79
+                    onPress={() => {
80
+                        const backAction = NavigationActions.back();
81
+                        this.props.navigation.dispatch(backAction);
82
+                    }}>
79 83
                     <CustomMaterialIcon
80 84
                         color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
81
-                        icon="arrow-left"/>
85
+                        icon={Platform.OS === 'chevron-left' ? "" : "arrow-left"}/>
82 86
                 </Touchable>;
83 87
         else
84 88
             button = this.props.leftButton;

Loading…
Cancel
Save