forked from onemolegames/react-native-toast-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
27 lines (21 loc) · 766 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
import {NativeModules, ToastAndroid, Platform} from "react-native";
var RCTToastNative = Platform.OS === 'android' ? NativeModules.Toast : NativeModules.RNToastNative;
var ToastNative = {};
if (Platform.OS === 'ios') {
ToastNative = {
//Toast duration constants
SHORT: RCTToastNative.SHORT,
LONG: RCTToastNative.LONG,
// Toast gravity constants
TOP: RCTToastNative.TOP,
BOTTOM: RCTToastNative.BOTTOM,
CENTER: RCTToastNative.CENTER,
show: function (message,
duration,
position,
styles) {
RCTToastNative.show(message || "This is a toast message", duration || ToastNative.SHORT, position || ToastNative.TOP, styles || {});
}
};
}
export default ToastNative;