Search in sources :

Example 36 with ReactMethod

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);
    });
}
Also used : Options(com.reactnativenavigation.options.Options) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 37 with ReactMethod

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));
    });
}
Also used : LayoutNode(com.reactnativenavigation.options.LayoutNode) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 38 with ReactMethod

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));
    });
}
Also used : LayoutNode(com.reactnativenavigation.options.LayoutNode) ViewController(com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController) ArrayList(java.util.ArrayList) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 39 with ReactMethod

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));
    });
}
Also used : LayoutNode(com.reactnativenavigation.options.LayoutNode) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 40 with ReactMethod

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");
    }
}
Also used : ShareApi(com.facebook.share.ShareApi) ShareContent(com.facebook.share.model.ShareContent) ReactMethod(com.facebook.react.bridge.ReactMethod)

Aggregations

ReactMethod (com.facebook.react.bridge.ReactMethod)82 Activity (android.app.Activity)21 Intent (android.content.Intent)11 WritableMap (com.facebook.react.bridge.WritableMap)11 Bundle (android.os.Bundle)9 ReactApplicationContext (com.facebook.react.bridge.ReactApplicationContext)6 WritableArray (com.facebook.react.bridge.WritableArray)6 ArrayList (java.util.ArrayList)5 Camera (android.hardware.Camera)4 NativeViewHierarchyManager (com.facebook.react.uimanager.NativeViewHierarchyManager)4 UIBlock (com.facebook.react.uimanager.UIBlock)4 UIManagerModule (com.facebook.react.uimanager.UIManagerModule)4 ShareContent (com.facebook.share.model.ShareContent)4 LayoutNode (com.reactnativenavigation.options.LayoutNode)4 LoginManager (com.facebook.login.LoginManager)3 ReactActivity (com.facebook.react.ReactActivity)3 LatLng (com.google.android.gms.maps.model.LatLng)3 ActivityNotFoundException (android.content.ActivityNotFoundException)2 RemoteException (android.os.RemoteException)2 JSApplicationIllegalArgumentException (com.facebook.react.bridge.JSApplicationIllegalArgumentException)2