Skip to content

Commit c44e67d

Browse files
authored
Update ShareMenuModule.java (#98)
1 parent b77a463 commit c44e67d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

android/src/main/java/com/meedan/ShareMenuModule.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,21 @@ public void getSharedText(Callback successCallback) {
9393
return;
9494
}
9595

96-
Intent intent = currentActivity.getIntent();
96+
//if this isn't the roor activity then make sure it is
97+
if (!currentActivity.isTaskRoot()) {
98+
Intent newIntent = new Intent(currentActivity.getIntent());
99+
newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
100+
currentActivity.startActivity(newIntent);
101+
102+
ReadableMap shared = extractShared(newIntent);
103+
successCallback.invoke(shared);
104+
clearSharedText();
105+
currentActivity.finish();
106+
return;
107+
}
97108

109+
Intent intent = currentActivity.getIntent();
110+
98111
ReadableMap shared = extractShared(intent);
99112
successCallback.invoke(shared);
100113
clearSharedText();

0 commit comments

Comments
 (0)