Selaa lähdekoodia

Invoke onSuccess for initial pushed child

Guy Carmeli 6 vuotta sitten
vanhempi
commit
6e3e922d01

+ 2
- 0
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/StackController.java Näytä tiedosto

@@ -105,6 +105,8 @@ 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());
108 110
         }
109 111
     }
110 112
 

+ 3
- 1
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/StackControllerTest.java Näytä tiedosto

@@ -76,8 +76,10 @@ public class StackControllerTest extends BaseTest {
76 76
     @Test
77 77
     public void push() {
78 78
         assertThat(uut.isEmpty()).isTrue();
79
-        uut.push(child1, new CommandListenerAdapter());
79
+        CommandListenerAdapter listener = spy(new CommandListenerAdapter());
80
+        uut.push(child1, listener);
80 81
         assertContainsOnlyId(child1.getId());
82
+        verify(listener, times(1)).onSuccess(child1.getId());
81 83
     }
82 84
 
83 85
     @Test