use of com.facebook.react.bridge.ReactMethod in project react-native-fbsdk by facebook.
the class FBShareAPIModule method share.
/**
* Share the content.
* @param shareContentMap must be a valid {@link ShareContent}.
* @param graphNode The graph node to share to (this can be a user id, event id, page id, group id, album
* id, etc).
* @param message The custom message that will accompany the share content.
* @param promise Use promise to pass share api result to JS.
*/
@ReactMethod
public void share(ReadableMap shareContentMap, String graphNode, String message, Promise promise) {
ShareContent shareContent = Utility.buildShareContent(shareContentMap);
if (shareContent != null) {
ShareApi shareApi = new ShareApi(shareContent);
shareApi.setGraphNode(graphNode);
shareApi.setMessage(message);
shareApi.share(new ShareAPICallback(promise));
} else {
promise.reject("ShareContent cannot be null");
}
}
use of com.facebook.react.bridge.ReactMethod in project react-native-fbsdk by facebook.
the class FBLoginManagerModule method logInWithReadPermissions.
/**
* Attempts a Facebook login with the specified read permissions.
* @param permissions must be one of the provided read permissions. See
* <a href="https://developers.facebook.com/docs/facebook-login/permissions">
* Facebook login permissions</a>.
* @param promise Use promise to pass login result to JS after login finish.
*/
@ReactMethod
public void logInWithReadPermissions(ReadableArray permissions, final Promise promise) {
final LoginManager loginManager = LoginManager.getInstance();
loginManager.registerCallback(mCallbackManager, new LoginManagerCallback(promise));
Activity activity = getCurrentActivity();
if (activity != null) {
loginManager.logInWithReadPermissions(activity, reactArrayToJavaStringCollection(permissions));
}
}
use of com.facebook.react.bridge.ReactMethod in project react-native-image-picker by marcshilling.
the class ImagePickerModule method launchImageLibrary.
// NOTE: Currently not reentrant / doesn't support concurrent requests
@ReactMethod
public void launchImageLibrary(final ReadableMap options, final Callback callback) {
final Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
responseHelper.invokeError(callback, "can't find current Activity");
return;
}
this.options = options;
if (!permissionsCheck(currentActivity, callback, REQUEST_PERMISSIONS_FOR_LIBRARY)) {
return;
}
parseOptions(this.options);
int requestCode;
Intent libraryIntent;
if (pickVideo) {
requestCode = REQUEST_LAUNCH_VIDEO_LIBRARY;
libraryIntent = new Intent(Intent.ACTION_PICK);
libraryIntent.setType("video/*");
} else {
requestCode = REQUEST_LAUNCH_IMAGE_LIBRARY;
libraryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
}
if (libraryIntent.resolveActivity(reactContext.getPackageManager()) == null) {
responseHelper.invokeError(callback, "Cannot launch photo library");
return;
}
this.callback = callback;
try {
currentActivity.startActivityForResult(libraryIntent, requestCode);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
responseHelper.invokeError(callback, "Cannot launch photo library");
}
}
use of com.facebook.react.bridge.ReactMethod in project react-native-navigation by wix.
the class NavigationReactModule method showLightBox.
@ReactMethod
public void showLightBox(final ReadableMap params) {
LightBoxParams lbp = new LightBoxParamsParser(BundleConverter.toBundle(params)).parse();
NavigationCommandsHandler.showLightBox(lbp);
}
use of com.facebook.react.bridge.ReactMethod in project react-native-gesture-handler by kmagiera.
the class RNGestureHandlerModule method updateGestureHandler.
@ReactMethod
public void updateGestureHandler(int handlerTag, ReadableMap config) {
GestureHandler handler = mRegistry.getHandler(handlerTag);
if (handler != null) {
HandlerFactory factory = findFactoryForHandler(handler);
if (factory != null) {
mInteractionManager.dropRelationsForHandlerWithTag(handlerTag);
mInteractionManager.configureInteractions(handler, config);
factory.configure(handler, config);
}
}
}
Aggregations