Browse Source

Invoke onSuccess for initial pushed child

Guy Carmeli 6 years ago
parent
commit
6e3e922d01

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

105
                 getView().removeView(toRemove.getView());
105
                 getView().removeView(toRemove.getView());
106
                 listener.onSuccess(child.getId());
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 View File

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