mirror of
https://github.com/wu736139669/react-native-QDDialog.git
synced 2026-08-05 06:18:35 +00:00
48 lines
1.1 KiB
JavaScript
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
|
|
}
|