Search in sources :

Example 1 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-push-notification by zo0r.

the class RNPushNotification method presentLocalNotification.

@ReactMethod
public void presentLocalNotification(ReadableMap details) {
    Bundle bundle = Arguments.toBundle(details);
    // If notification ID is not provided by the user, generate one at random
    if (bundle.getString("id") == null) {
        bundle.putString("id", String.valueOf(mRandomNumberGenerator.nextInt()));
    }
    mRNPushNotificationHelper.sendToNotificationCentre(bundle);
}
Also used : Bundle(android.os.Bundle) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 2 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-push-notification by zo0r.

the class RNPushNotification method getInitialNotification.

@ReactMethod
public void getInitialNotification(Promise promise) {
    WritableMap params = Arguments.createMap();
    Activity activity = getCurrentActivity();
    if (activity != null) {
        Intent intent = activity.getIntent();
        Bundle bundle = intent.getBundleExtra("notification");
        if (bundle != null) {
            bundle.putBoolean("foreground", false);
            String bundleString = mJsDelivery.convertJSON(bundle);
            params.putString("dataJSON", bundleString);
        }
    }
    promise.resolve(params);
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap) Bundle(android.os.Bundle) Activity(android.app.Activity) Intent(android.content.Intent) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 3 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-push-notification by zo0r.

the class RNPushNotification method requestPermissions.

@ReactMethod
public void requestPermissions(String senderID) {
    ReactContext reactContext = getReactApplicationContext();
    Intent GCMService = new Intent(reactContext, RNPushNotificationRegistrationService.class);
    GCMService.putExtra("senderID", senderID);
    reactContext.startService(GCMService);
}
Also used : ReactContext(com.facebook.react.bridge.ReactContext) Intent(android.content.Intent) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 4 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-navigation by wix.

the class NavigationReactModule method showSnackbar.

@ReactMethod
public void showSnackbar(final ReadableMap params) {
    SnackbarParams snackbarParams = new SnackbarParamsParser().parse(BundleConverter.toBundle(params));
    NavigationCommandsHandler.showSnackbar(snackbarParams);
}
Also used : SnackbarParamsParser(com.reactnativenavigation.params.parsers.SnackbarParamsParser) SnackbarParams(com.reactnativenavigation.params.SnackbarParams) ReactMethod(com.facebook.react.bridge.ReactMethod)

Example 5 with ReactMethod

use of com.facebook.react.bridge.ReactMethod in project react-native-navigation by wix.

the class NavigationReactModule method showSlidingOverlay.

@ReactMethod
public void showSlidingOverlay(final ReadableMap params) {
    SlidingOverlayParams slidingOverlayParams = new SlidingOverlayParamsParser().parse(BundleConverter.toBundle(params));
    NavigationCommandsHandler.showSlidingOverlay(slidingOverlayParams);
}
Also used : SlidingOverlayParams(com.reactnativenavigation.params.SlidingOverlayParams) SlidingOverlayParamsParser(com.reactnativenavigation.params.parsers.SlidingOverlayParamsParser) ReactMethod(com.facebook.react.bridge.ReactMethod)

Aggregations

ReactMethod (com.facebook.react.bridge.ReactMethod)84 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 NotificationManager (android.app.NotificationManager)2 ActivityNotFoundException (android.content.ActivityNotFoundException)2 RemoteException (android.os.RemoteException)2 JSApplicationIllegalArgumentException (com.facebook.react.bridge.JSApplicationIllegalArgumentException)2