forked from lucasferreira/react-native-send-intent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
90 lines (87 loc) · 3.24 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
* @providesModule SendIntentAndroid
*/
var { Platform, NativeModules } = require("react-native");
var RNSendIntentAndroid = NativeModules.SendIntentAndroid || {};
var SendIntentAndroid = {
TEXT_PLAIN: Platform.OS === "android" ? RNSendIntentAndroid.TEXT_PLAIN : "text/plain",
TEXT_HTML: Platform.OS === "android" ? RNSendIntentAndroid.TEXT_HTML : "text/html",
sendText(config) {
if ("title" in config && config.title != null && config.title.length > 0) {
RNSendIntentAndroid.sendTextWithTitle(config.title, config.text, config.type || "text/plain");
} else {
RNSendIntentAndroid.sendText(config.text, config.type || "text/plain");
}
},
sendPhoneCall(phoneNumber, phoneAppOnly = false) {
RNSendIntentAndroid.sendPhoneCall(phoneNumber, phoneAppOnly);
},
sendPhoneDial(phoneNumber, phoneAppOnly = false) {
RNSendIntentAndroid.sendPhoneDial(phoneNumber, phoneAppOnly);
},
sendSms(phoneNumber, body = null) {
RNSendIntentAndroid.sendSms(phoneNumber, body);
},
addCalendarEvent(config) {
RNSendIntentAndroid.addCalendarEvent(
config.title,
config.description,
config.startDate,
config.endDate,
config.recurrence,
config.location,
config.isAllDay || false
);
},
isAppInstalled(packageName) {
return RNSendIntentAndroid.isAppInstalled(packageName);
},
installRemoteApp(uri, saveAs) {
return RNSendIntentAndroid.installRemoteApp(uri, saveAs);
},
openCalendar() {
RNSendIntentAndroid.openCalendar();
},
sendMail(mail, subject = "", body = "") {
RNSendIntentAndroid.sendMail(mail, subject, body);
},
openChooserWithOptions(options, title) {
RNSendIntentAndroid.openChooserWithOptions(options, title);
},
openChooserWithMultipleOptions(options, title) {
RNSendIntentAndroid.openChooserWithMultipleOptions(options, title);
},
openMaps(query) {
RNSendIntentAndroid.openMaps(query);
},
openCamera() {
RNSendIntentAndroid.openCamera();
},
openMapsWithRoute(query, mode) {
RNSendIntentAndroid.openMapsWithRoute(query, mode);
},
shareTextToLine(options) {
RNSendIntentAndroid.shareTextToLine(options);
},
shareImageToInstagram(type, mediaPath) {
RNSendIntentAndroid.shareImageToInstagram(type, mediaPath);
},
openSettings(settingsName) {
RNSendIntentAndroid.openSettings(settingsName);
},
getVoiceMailNumber() {
return RNSendIntentAndroid.getVoiceMailNumber();
},
openApp(packageName, extras) {
return RNSendIntentAndroid.openApp(packageName, extras || {});
},
/** Creates an ACTION_VIEW Intent for the given package with the given data, optional mimetype and extras.
* The extras are an object containing String, or other objects of the following format:
* { type: "int", value: 4 }
* Other possible types are int, short, byte, char, long and float.
*/
openAppWithData(packageName, dataUri, mimeType, extras) {
return RNSendIntentAndroid.openAppWithData(packageName, dataUri, mimeType, extras || {});
},
};
module.exports = SendIntentAndroid;