mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-01 22:35:29 +08:00
Convert modules to use @ReactModule instead of getName()
Reviewed By: astreet Differential Revision: D3334273 fbshipit-source-id: a33bf72c5c184844885ef3ef610a05d9c102c8ea
This commit is contained in:
committed by
Facebook Github Bot 2
parent
9965642ebc
commit
c64213653e
@@ -11,21 +11,20 @@ package com.facebook.react.modules.share;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.bridge.annotations.ReactModule;
|
||||
|
||||
/**
|
||||
* Intent module. Launch other activities or open URLs.
|
||||
*/
|
||||
@ReactModule(name = "ShareModule")
|
||||
public class ShareModule extends ReactContextBaseJavaModule {
|
||||
|
||||
/* package */ static final String ACTION_SHARED = "sharedAction";
|
||||
@@ -36,11 +35,6 @@ public class ShareModule extends ReactContextBaseJavaModule {
|
||||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "ShareModule";
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a chooser dialog to send text content to other apps.
|
||||
*
|
||||
@@ -80,11 +74,9 @@ public class ShareModule extends ReactContextBaseJavaModule {
|
||||
WritableMap result = Arguments.createMap();
|
||||
result.putString("action", ACTION_SHARED);
|
||||
promise.resolve(result);
|
||||
|
||||
} catch (Exception e) {
|
||||
promise.reject(ERROR_UNABLE_TO_OPEN_DIALOG, "Failed to open share dialog");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user