use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class FloatingActionButtonTest method hideOnPush.
@Test
public void hideOnPush() {
stackController.push(childFab, new CommandListenerAdapter());
childFab.onViewWillAppear();
assertThat(hasFab()).isTrue();
stackController.push(childNoFab, new CommandListenerAdapter());
childNoFab.onViewWillAppear();
assertThat(hasFab()).isFalse();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class FloatingActionButtonTest method hideOnPop.
@Test
public void hideOnPop() {
disablePushAnimation(childNoFab, childFab);
stackController.push(childNoFab, new CommandListenerAdapter());
stackController.push(childFab, new CommandListenerAdapter());
childFab.onViewWillAppear();
assertThat(hasFab()).isTrue();
stackController.pop(Options.EMPTY, new CommandListenerAdapter());
childNoFab.onViewWillAppear();
assertThat(hasFab()).isFalse();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class ModalPresenterTest method showModal_resolvesDefaultOptions.
@Test
public void showModal_resolvesDefaultOptions() throws JSONException {
Options defaultOptions = new Options();
JSONObject disabledShowModalAnimation = TransitionAnimationOptionsTestKt.newModalAnimationJson(false);
defaultOptions.animations.showModal = TransitionAnimationOptionsKt.parseTransitionAnimationOptions(disabledShowModalAnimation);
uut.setDefaultOptions(defaultOptions);
uut.showModal(modal1, root, new CommandListenerAdapter());
verifyNoInteractions(animator);
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class ModalStack method dismissModal.
public boolean dismissModal(String componentId, @Nullable ViewController<?> root, CommandListener listener) {
ViewController<?> toDismiss = findModalByComponentId(componentId);
if (toDismiss != null) {
boolean isDismissingTopModal = isTop(toDismiss);
modals.remove(toDismiss);
@Nullable ViewController<?> toAdd = isEmpty() ? root : isDismissingTopModal ? get(size() - 1) : null;
if (isDismissingTopModal) {
if (toAdd == null) {
listener.onError("Could not dismiss modal");
return false;
}
}
presenter.dismissModal(toDismiss, toAdd, root, new CommandListenerAdapter(listener) {
@Override
public void onSuccess(String childId) {
eventEmitter.emitModalDismissed(toDismiss.getId(), toDismiss.getCurrentComponentName(), 1);
super.onSuccess(toDismiss.getId());
}
});
return true;
} else {
listener.onError("Nothing to dismiss");
return false;
}
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class BackButtonHelperTest method addToChild_doesNotAddIfBackButtonHidden.
@Test
public void addToChild_doesNotAddIfBackButtonHidden() {
disablePushAnimation(child1, child2);
stack.push(child1, new CommandListenerAdapter());
child2.options.topBar.buttons.back.visible = new Bool(false);
stack.push(child2, new CommandListenerAdapter());
verify(child2, times(0)).mergeOptions(any());
}
Aggregations