Browse Source

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

Artal Druk 7 years ago
parent
commit
3dd185ecad

+ 4
- 2
android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java View File

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
     }