Search in sources :

Example 11 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-fcm by evollu.

the class FIRMessagingModule method scheduleLocalNotification.

@ReactMethod
public void scheduleLocalNotification(ReadableMap details) {
    Bundle bundle = Arguments.toBundle(details);
    mFIRLocalMessagingHelper.sendNotificationScheduled(bundle);
}
Also used : Bundle(android.os.Bundle) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 12 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-fcm by evollu.

the class FIRMessagingModule method getInitialNotification.

@ReactMethod
public void getInitialNotification(Promise promise) {
    Activity activity = getCurrentActivity();
    if (activity == null) {
        promise.resolve(null);
        return;
    }
    promise.resolve(parseIntent(activity.getIntent()));
}
Also used : Activity(android.app.Activity) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 13 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-gesture-handler by kmagiera.

the class RNGestureHandlerModule method createGestureHandler.

@ReactMethod
public void createGestureHandler(String handlerName, int handlerTag, ReadableMap config) {
    for (int i = 0; i < mHandlerFactories.length; i++) {
        HandlerFactory handlerFactory = mHandlerFactories[i];
        if (handlerFactory.getName().equals(handlerName)) {
            GestureHandler handler = handlerFactory.create(getReactApplicationContext());
            handler.setTag(handlerTag);
            handler.setOnTouchEventListener(mEventListener);
            mRegistry.registerHandler(handler);
            mInteractionManager.configureInteractions(handler, config);
            handlerFactory.configure(handler, config);
            return;
        }
    }
    throw new JSApplicationIllegalArgumentException("Invalid handler name " + handlerName);
}
Also used : TapGestureHandler(com.swmansion.gesturehandler.TapGestureHandler) GestureHandler(com.swmansion.gesturehandler.GestureHandler) PinchGestureHandler(com.swmansion.gesturehandler.PinchGestureHandler) PanGestureHandler(com.swmansion.gesturehandler.PanGestureHandler) RotationGestureHandler(com.swmansion.gesturehandler.RotationGestureHandler) LongPressGestureHandler(com.swmansion.gesturehandler.LongPressGestureHandler) NativeViewGestureHandler(com.swmansion.gesturehandler.NativeViewGestureHandler) JSApplicationIllegalArgumentException(com.facebook.react.bridge.JSApplicationIllegalArgumentException) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 14 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-camera by react-native-community.

the class CameraModule method record.

@ReactMethod
public void record(final ReadableMap options, final int viewTag, final Promise promise) {
    final ReactApplicationContext context = getReactApplicationContext();
    final File cacheDirectory = mScopedContext.getCacheDirectory();
    UIManagerModule uiManager = context.getNativeModule(UIManagerModule.class);
    uiManager.addUIBlock(new UIBlock() {

        @Override
        public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) {
            final RNCameraView cameraView;
            try {
                cameraView = (RNCameraView) nativeViewHierarchyManager.resolveView(viewTag);
                if (cameraView.isCameraOpened()) {
                    cameraView.record(options, promise, cacheDirectory);
                } else {
                    promise.reject("E_CAMERA_UNAVAILABLE", "Camera is not running");
                }
            } catch (Exception e) {
                promise.reject("E_CAMERA_BAD_VIEWTAG", "recordAsync: Expected a Camera component");
            }
        }
    });
}
Also used : UIBlock(com.facebook.react.uimanager.UIBlock) UIManagerModule(com.facebook.react.uimanager.UIManagerModule) ReactApplicationContext(com.facebook.react.bridge.ReactApplicationContext) File(java.io.File) NativeViewHierarchyManager(com.facebook.react.uimanager.NativeViewHierarchyManager) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 15 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-fbads by callstack.

the class AdSettingsManager method addTestDevice.

@ReactMethod
public void addTestDevice(String deviceHashedId) {
    if (deviceHashedId.equals("current")) {
        SharedPreferences sp = getReactApplicationContext().getSharedPreferences("FBAdPrefs", 0);
        deviceHashedId = sp.getString("deviceIdHash", null);
    }
    AdSettings.addTestDevice(deviceHashedId);
}
Also used : SharedPreferences(android.content.SharedPreferences) 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