use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method push.
@Test
public void push() {
StackController stackController = newStack();
stackController.push(child1, new CommandListenerAdapter());
uut.setRoot(stackController, new CommandListenerAdapter(), reactInstanceManager);
assertIsChild(uut.getView(), stackController.getView());
assertIsChild(stackController.getView(), child1.getView());
uut.push(child1.getId(), child2, new CommandListenerAdapter());
assertIsChild(uut.getView(), stackController.getView());
assertIsChild(stackController.getView(), child2.getView());
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method shouldCallOnViewDidAppearWhenHostResumes.
@Test
public void shouldCallOnViewDidAppearWhenHostResumes() {
SimpleViewController child1 = spy(this.child1);
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
uut.onHostResume();
verify(child1, times(2)).onViewDidAppear();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class ParentControllerTest method optionsAreClearedWhenChildIsAppeared.
@Test
public void optionsAreClearedWhenChildIsAppeared() {
StackController stackController = spy(TestUtils.newStackController(activity).build());
stackController.ensureViewIsCreated();
SimpleViewController child1 = new SimpleViewController(activity, childRegistry, "child1", new Options());
stackController.push(child1, new CommandListenerAdapter());
child1.onViewWillAppear();
verify(stackController, times(1)).clearOptions();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class Navigator method setRoot.
public void setRoot(final ViewController<?> appearing, CommandListener commandListener, ReactInstanceManager reactInstanceManager) {
previousRoot = root;
modalStack.destroy();
final boolean removeSplashView = isRootNotCreated();
if (isRootNotCreated())
getView();
final ViewController<?> disappearing = previousRoot;
root = appearing;
root.setOverlay(new RootOverlay(getActivity(), contentLayout));
root.setParentController(this);
rootPresenter.setRoot(appearing, disappearing, defaultOptions, new CommandListenerAdapter(commandListener) {
@Override
public void onSuccess(String childId) {
root.onViewDidAppear();
if (removeSplashView)
contentLayout.removeViewAt(0);
destroyPreviousRoot();
super.onSuccess(childId);
}
}, reactInstanceManager);
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class SideMenuControllerTest method handleBack_closesLeftMenu.
@Test
public void handleBack_closesLeftMenu() {
uut.setLeftController(left);
assertThat(uut.handleBack(new CommandListenerAdapter())).isFalse();
verify(center, times(1)).handleBack(any());
openLeftMenu();
assertThat(uut.handleBack(new CommandListenerAdapter())).isTrue();
verify(center, times(1)).handleBack(any());
}
Aggregations