use of com.reactnativenavigation.options.LayoutNode in project react-native-navigation by wix.
the class NavigationModule method setRoot.
@ReactMethod
public void setRoot(String commandId, ReadableMap rawLayoutTree, Promise promise) {
final LayoutNode layoutTree = LayoutNodeParser.parse(Objects.requireNonNull(jsonParser.parse(rawLayoutTree).optJSONObject("root")));
handle(() -> {
final ViewController<?> viewController = layoutFactory.create(layoutTree);
navigator().setRoot(viewController, new NativeCommandListener("setRoot", commandId, promise, eventEmitter, now), reactInstanceManager);
});
}
use of com.reactnativenavigation.options.LayoutNode in project react-native-navigation by wix.
the class NavigationModule method showModal.
@ReactMethod
public void showModal(String commandId, ReadableMap rawLayoutTree, Promise promise) {
final LayoutNode layoutTree = LayoutNodeParser.parse(jsonParser.parse(rawLayoutTree));
handle(() -> {
final ViewController<?> viewController = layoutFactory.create(layoutTree);
navigator().showModal(viewController, new NativeCommandListener("showModal", commandId, promise, eventEmitter, now));
});
}
use of com.reactnativenavigation.options.LayoutNode in project react-native-navigation by wix.
the class NavigationModule method setStackRoot.
@ReactMethod
public void setStackRoot(String commandId, String onComponentId, ReadableArray children, Promise promise) {
handle(() -> {
ArrayList<ViewController<?>> _children = new ArrayList<>();
for (int i = 0; i < children.size(); i++) {
final LayoutNode layoutTree = LayoutNodeParser.parse(jsonParser.parse(children.getMap(i)));
_children.add(layoutFactory.create(layoutTree));
}
navigator().setStackRoot(onComponentId, _children, new NativeCommandListener("setStackRoot", commandId, promise, eventEmitter, now));
});
}
use of com.reactnativenavigation.options.LayoutNode in project react-native-navigation by wix.
the class NavigationModule method push.
@ReactMethod
public void push(String commandId, String onComponentId, ReadableMap rawLayoutTree, Promise promise) {
final LayoutNode layoutTree = LayoutNodeParser.parse(jsonParser.parse(rawLayoutTree));
handle(() -> {
final ViewController<?> viewController = layoutFactory.create(layoutTree);
navigator().push(onComponentId, viewController, new NativeCommandListener("push", commandId, promise, eventEmitter, now));
});
}
use of com.reactnativenavigation.options.LayoutNode in project react-native-navigation by wix.
the class LayoutNodeParser method parse.
@SuppressWarnings("unchecked")
public static LayoutNode parse(JSONObject layoutTree) {
String id = layoutTree.optString("id");
LayoutNode.Type type = LayoutNode.Type.valueOf(layoutTree.optString("type"));
JSONObject data = parseData(layoutTree);
List<LayoutNode> children = parseChildren(layoutTree);
return new LayoutNode(id, type, data, children);
}
Aggregations