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,12 +172,14 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
172 172
 
173 173
     @Override
174 174
     public void invokeDefaultOnBackPressed() {
175
-        super.onBackPressed();
175
+        if (layout != null && !layout.onBackPressed()) {
176
+            super.onBackPressed();
177
+        }
176 178
     }
177 179
 
178 180
     @Override
179 181
     public void onBackPressed() {
180
-        if (layout != null && !layout.onBackPressed()) {
182
+        if (getReactGateway().isInitialized()) {
181 183
             getReactGateway().onBackPressed();
182 184
         }
183 185
     }