Browse Source

Revert "Add previous screen at index 0 when popping"

This reverts commit db567ea7b3.
Guy Carmeli 6 years ago
parent
commit
f64791a720

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

@@ -105,8 +105,6 @@ public class StackController extends ParentController<StackLayout> {
105 105
                 getView().removeView(toRemove.getView());
106 106
                 listener.onSuccess(child.getId());
107 107
             }
108
-        } else {
109
-            listener.onSuccess(child.getId());
110 108
         }
111 109
     }
112 110
 
@@ -140,7 +138,9 @@ public class StackController extends ParentController<StackLayout> {
140 138
         final ViewController appearing = stack.peek();
141 139
         disappearing.onViewWillDisappear();
142 140
         appearing.onViewWillAppear();
143
-        getView().onChildWillDisappear(disappearing.options, appearing.options, () -> getView().addView(appearing.getView(), 0));
141
+        getView().onChildWillDisappear(disappearing.options, appearing.options, () ->
142
+                getView().addView(appearing.getView())
143
+        );
144 144
 
145 145
         if (disappearing.options.animated.isTrueOrUndefined()) {
146 146
             animator.pop(disappearing.getView(), () -> finishPopping(disappearing, listener));

+ 2
- 4
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/StackControllerTest.java View File

@@ -76,10 +76,8 @@ public class StackControllerTest extends BaseTest {
76 76
     @Test
77 77
     public void push() {
78 78
         assertThat(uut.isEmpty()).isTrue();
79
-        CommandListenerAdapter listener = spy(new CommandListenerAdapter());
80
-        uut.push(child1, listener);
79
+        uut.push(child1, new CommandListenerAdapter());
81 80
         assertContainsOnlyId(child1.getId());
82
-        verify(listener, times(1)).onSuccess(child1.getId());
83 81
     }
84 82
 
85 83
     @Test
@@ -204,7 +202,7 @@ public class StackControllerTest extends BaseTest {
204 202
     }
205 203
 
206 204
     @Test
207
-    public void pop_doesNothingWhenZeroOrOneChild() {
205
+    public void popDoesNothingWhenZeroOrOneChild() {
208 206
         assertThat(uut.isEmpty()).isTrue();
209 207
         uut.pop(new CommandListenerAdapter());
210 208
         assertThat(uut.isEmpty()).isTrue();