forked from xgfe/react-native-simple-toast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
31 lines (25 loc) · 761 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
import {NativeModules,ToastAndroid,Platform} from 'react-native';
var RCTToastAndroid = Platform.OS === 'android' ? ToastAndroid : NativeModules.LRDRCTSimpleToast;
var SimpleToast = {
// Toast duration constants
SHORT: RCTToastAndroid.SHORT,
LONG: RCTToastAndroid.LONG,
// Toast gravity constants
TOP: RCTToastAndroid.TOP,
BOTTOM: RCTToastAndroid.BOTTOM,
CENTER: RCTToastAndroid.CENTER,
show: function (
message,
duration
) {
RCTToastAndroid.show(message, duration === undefined ? this.SHORT : duration);
},
showWithGravity: function (
message,
duration,
gravity,
) {
RCTToastAndroid.showWithGravity(message, duration === undefined ? this.SHORT : duration, gravity);
},
};
export default SimpleToast;