forked from lucasferreira/react-native-send-intent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
55 lines (51 loc) · 1.84 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
/**
* @providesModule SendIntentAndroid
*/
'use strict';
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) {
RNSendIntentAndroid.sendPhoneCall(phoneNumber);
},
sendPhoneDial(phoneNumber) {
RNSendIntentAndroid.sendPhoneDial(phoneNumber);
},
sendSms(phoneNumber, body) {
RNSendIntentAndroid.sendSms(phoneNumber, (body||null));
},
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);
},
openApp(packageName) {
return RNSendIntentAndroid.openApp(packageName);
},
openCalendar() {
RNSendIntentAndroid.openCalendar();
},
sendMail(mail, subject, body) {
RNSendIntentAndroid.sendMail(mail, (subject || ''), (body || ''));
},
openChooserWithOptions(options: Object, title: string) {
RNSendIntentAndroid.openChooserWithOptions(options, title);
},
openMaps(query) {
RNSendIntentAndroid.openMaps(query);
}
};
module.exports = SendIntentAndroid;