Browse Source

Fix crash when popping a screen that was pushed without animation

Guy Carmeli 6 years ago
parent
commit
08fff3d9ec

+ 7
- 0
e2e/ScreenStack.test.js View File

@@ -16,6 +16,13 @@ describe('screen stack', () => {
16 16
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
17 17
   });
18 18
 
19
+  it('push and pop screen with out animation', async () => {
20
+    await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
21
+    await expect(elementById(testIDs.OPTIONS_SCREEN_HEADER)).toBeVisible();
22
+    Android.pressBack();
23
+    await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
24
+  });
25
+
19 26
   it('pop screen deep in the stack', async () => {
20 27
     await elementById(testIDs.PUSH_BUTTON).tap();
21 28
     await expect(elementByLabel('Stack Position: 1')).toBeVisible();

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/StackController.java View File

@@ -139,7 +139,7 @@ public class StackController extends ParentController<StackLayout> {
139 139
         disappearing.onViewWillDisappear();
140 140
         appearing.onViewWillAppear();
141 141
         getView().onChildWillDisappear(disappearing.options, appearing.options, () ->
142
-                getView().addView(appearing.getView(), getView().indexOfChild(disappearing.getView()))
142
+                getView().addView(appearing.getView())
143 143
         );
144 144
 
145 145
         if (disappearing.options.animated.isTrueOrUndefined()) {