浏览代码

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

Artal Druk 7 年前
父节点
当前提交
3dd185ecad

+ 4
- 2
android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java 查看文件

@@ -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
     }