forked from Expensify/react-native-share-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (36 loc) · 1021 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { NativeModules, NativeEventEmitter } from "react-native";
const { ShareMenu } = NativeModules;
const EventEmitter = new NativeEventEmitter(ShareMenu);
const NEW_SHARE_EVENT_NAME = "NewShareEvent";
export const ShareMenuReactView = {
dismissExtension(error = null) {
NativeModules.ShareMenuReactView.dismissExtension(error);
},
openApp() {
NativeModules.ShareMenuReactView.openApp();
},
continueInApp(extraData = null) {
NativeModules.ShareMenuReactView.continueInApp(extraData);
},
data() {
return NativeModules.ShareMenuReactView.data();
},
};
export default {
/**
* @deprecated Use `getInitialShare` instead. This is here for backwards compatibility.
*/
getSharedText(callback) {
this.getInitialShare(callback);
},
getInitialShare(callback) {
ShareMenu.getSharedText(callback);
},
addNewShareListener(callback) {
const subscription = EventEmitter.addListener(
NEW_SHARE_EVENT_NAME,
callback
);
return subscription;
},
};