use of com.facebook.react.bridge.ReactMethod in project react-native-navigation by wix.
the class NavigationModule method setDefaultOptions.
@ReactMethod
public void setDefaultOptions(ReadableMap options) {
handle(() -> {
Options defaultOptions = parse(options);
layoutFactory.setDefaultOptions(defaultOptions);
navigator().setDefaultOptions(defaultOptions);
});
}
use of com.facebook.react.bridge.ReactMethod 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.facebook.react.bridge.ReactMethod 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.facebook.react.bridge.ReactMethod 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.facebook.react.bridge.ReactMethod in project react-native-fbsdk by facebook.
the class FBShareAPIModule method canShare.
/**
* Check if the content can be shared.
* @param shareContentMap must be a valid {@link ShareContent}
* @param promise Use promise to pass the result to JS.
*/
@ReactMethod
public void canShare(ReadableMap shareContentMap, Promise promise) {
ShareContent shareContent = Utility.buildShareContent(shareContentMap);
if (shareContent != null) {
ShareApi shareApi = new ShareApi(shareContent);
promise.resolve(shareApi.canShare());
} else {
promise.reject("ShareContent cannot be null");
}
}
Aggregations