diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/share/ShareModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/share/ShareModule.java index 06b4a1aea17084..11ff1c0bb65db5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/share/ShareModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/share/ShareModule.java @@ -12,6 +12,9 @@ import android.app.Activity; import android.content.Intent; +import android.net.Uri; +import java.io.File; + import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.ReactApplicationContext; @@ -59,6 +62,14 @@ public void share(ReadableMap content, String dialogTitle, Promise promise) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setTypeAndNormalize("text/plain"); + if (content.hasKey("imgPath")) { + intent.setTypeAndNormalize("image/*"); + String strPath=content.getString("imgPath"); + File f = new File(strPath); + Uri u = Uri.fromFile(f); + intent.putExtra(Intent.EXTRA_STREAM, u); + } + if (content.hasKey("title")) { intent.putExtra(Intent.EXTRA_SUBJECT, content.getString("title")); }