-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathrnutils.js
More file actions
51 lines (47 loc) · 1.33 KB
/
Copy pathrnutils.js
File metadata and controls
51 lines (47 loc) · 1.33 KB
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
/**
* @providesModule RNUTils
* @flow
*/
'use strict';
var React = require('react-native');
var {
NativeModules
} = React;
var RCTUtilsManager = NativeModules.Utils;
var RNUtils = {
sendSMS: function (message, phone_numbers, callback) {
// Check the params
if (phone_numbers.constructor !== Array) {
if (callback) {
callback("Error: phone_numbers need to be an array", false)
}
} else {
RCTUtilsManager.sendSMS(message, phone_numbers, function (response) {
if (response === "sent") {
if (callback) {
callback(null, true)
}
} else if (response === "failed") {
if (callback) {
callback("Error: Message sent failed", false)
}
} else {
if (callback) {
callback(null, null)
}
}
})
}
},
openSettings: function () {
RCTUtilsManager.openSettings()
},
isOnCall: function (callback) {
RCTUtilsManager.isOnCall(function (response) {
if (callback) {
callback(response === "yes")
}
})
}
};
module.exports = RNUtils;