Search in sources :

Example 6 with LayoutNode

use of com.reactnativenavigation.options.LayoutNode in project react-native-navigation by wix.

the class NavigationModule method showOverlay.

@ReactMethod
public void showOverlay(String commandId, ReadableMap rawLayoutTree, Promise promise) {
    final LayoutNode layoutTree = LayoutNodeParser.parse(jsonParser.parse(rawLayoutTree));
    handle(() -> {
        final ViewController<?> viewController = layoutFactory.create(layoutTree);
        navigator().showOverlay(viewController, new NativeCommandListener("showOverlay", commandId, promise, eventEmitter, now));
    });
}
Also used : LayoutNode(com.reactnativenavigation.options.LayoutNode) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 7 with LayoutNode

use of com.reactnativenavigation.options.LayoutNode in project react-native-navigation by wix.

the class LayoutFactoryTest method component.

private LayoutNode component() throws JSONException {
    final JSONObject component = new JSONObject();
    final JSONObject layout = new JSONObject();
    final JSONObject backgroundColor = new JSONObject();
    backgroundColor.put("dark", 0);
    backgroundColor.put("light", 1);
    layout.put("backgroundColor", backgroundColor);
    component.put("name", "com.component");
    component.put("options", new JSONObject().put("layout", layout));
    return new LayoutNode("Component1", LayoutNode.Type.Component, component, null);
}
Also used : LayoutNode(com.reactnativenavigation.options.LayoutNode) JSONObject(org.json.JSONObject)

Aggregations

LayoutNode (com.reactnativenavigation.options.LayoutNode)7 ReactMethod (com.facebook.react.bridge.ReactMethod)5 JSONObject (org.json.JSONObject)2 ViewController (com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController)1 ArrayList (java.util.ArrayList)1