Explorar o código

#27 Back button should close the app when there is nothing in app history

Alex Trofimov %!s(int64=5) %!d(string=hai) anos
pai
achega
2deffea228
Modificáronse 1 ficheiros con 7 adicións e 2 borrados
  1. 7 2
      App.js

+ 7 - 2
App.js

@@ -413,8 +413,13 @@ export default class App extends Component<Props> {
 
         if (Platform.OS === 'android') {
             this.backHandler = BackHandler.addEventListener('hardwareBackPress', () => {
-                this.onBack(); // works best when the goBack is async
-                return true;
+                if (this.state.backButtonEnabled) {
+                    this.onBack(); // works best when the goBack is async
+                    return true;
+                }
+                else {
+                    return false;
+                }
             });
         }