Parcourir la source

fix issues with Android BackHandler listeners not getting called, not allowing to override the back functionality from the JS side (#2057)

Artal Druk il y a 7 ans
Parent
révision
3dd185ecad

+ 4
- 2
android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java Voir le fichier

172
 
172
 
173
     @Override
173
     @Override
174
     public void invokeDefaultOnBackPressed() {
174
     public void invokeDefaultOnBackPressed() {
175
-        super.onBackPressed();
175
+        if (layout != null && !layout.onBackPressed()) {
176
+            super.onBackPressed();
177
+        }
176
     }
178
     }
177
 
179
 
178
     @Override
180
     @Override
179
     public void onBackPressed() {
181
     public void onBackPressed() {
180
-        if (layout != null && !layout.onBackPressed()) {
182
+        if (getReactGateway().isInitialized()) {
181
             getReactGateway().onBackPressed();
183
             getReactGateway().onBackPressed();
182
         }
184
         }
183
     }
185
     }