Files
react-native-QDDialog/index.js
T
2018-11-14 18:50:40 +08:00

48 lines
1.1 KiB
JavaScript

import {NativeModules, Platform} from 'react-native';
let handler;
if (Platform.OS === 'ios') {
handler = NativeModules.QXXDialogModule;
} else {
handler = NativeModules.QXXDialogModule;
}
/**
* 调用Dialog
*/
function showContentDialog(title, content, confirmStr, canBack, touchOutSideDismiss) {
return handler.showContentDialog(title, content, confirmStr, canBack, touchOutSideDismiss);
}
function showInfoDialog(title, content, confirmStr, cancelStr, canBack, touchOutSideDismiss) {
return handler.showInfoDialog(title, content, confirmStr, cancelStr, canBack, touchOutSideDismiss);
}
function showLoadingDialog(title) {
if (Platform.OS === 'ios') {
handler.showLoadingDialog(title);
} else {
console.log(handler)
handler.showLoadingDialog(title);
}
}
function hideLoadingDialog() {
if (Platform.OS === 'ios') {
handler.hideLoadingDialog();
} else {
handler.hideLoadingDialog();
}
}
export default {
showInfoDialog,
showContentDialog,
showLoadingDialog,
hideLoadingDialog
}