|
@@ -61,7 +61,7 @@ const showResultDialog = (message, ok, back) => {
|
|
|
const showProgressDialog = (message='Loading...') => {
|
|
const showProgressDialog = (message='Loading...') => {
|
|
|
//message = message ?? 'Waiting...';
|
|
//message = message ?? 'Waiting...';
|
|
|
ModalPortal.showLoading((
|
|
ModalPortal.showLoading((
|
|
|
- isIOS ? <IOSProgress message={message}/>
|
|
|
|
|
|
|
+ isIOS ? message//<IOSProgress message={message}/>
|
|
|
: <AndroidProgress message={message}/>
|
|
: <AndroidProgress message={message}/>
|
|
|
));
|
|
));
|
|
|
}
|
|
}
|
|
@@ -369,13 +369,16 @@ const andStyles = StyleSheet.create({
|
|
|
progressView: {
|
|
progressView: {
|
|
|
alignItems: 'center',
|
|
alignItems: 'center',
|
|
|
flexDirection: 'row'
|
|
flexDirection: 'row'
|
|
|
|
|
+ },
|
|
|
|
|
+ endView: {
|
|
|
|
|
+ paddingTop: 16
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
export default Dialog = {
|
|
export default Dialog = {
|
|
|
- styles: andStyles,
|
|
|
|
|
BUTTON_OK: BUTTON_OK,
|
|
BUTTON_OK: BUTTON_OK,
|
|
|
BUTTON_CANCEL: BUTTON_CANCEL,
|
|
BUTTON_CANCEL: BUTTON_CANCEL,
|
|
|
|
|
+ isShowing: ModalPortal.isShowing,
|
|
|
showDialog: showDialog,
|
|
showDialog: showDialog,
|
|
|
dismissAll: dismissAll,
|
|
dismissAll: dismissAll,
|
|
|
dismissDialog: dismissDialog,
|
|
dismissDialog: dismissDialog,
|
|
@@ -389,20 +392,38 @@ export default Dialog = {
|
|
|
propagateSwipe: true,
|
|
propagateSwipe: true,
|
|
|
useNativeDriver: true,
|
|
useNativeDriver: true,
|
|
|
hideModalContentWhileAnimating: true
|
|
hideModalContentWhileAnimating: true
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ styles: andStyles,
|
|
|
|
|
+ IOSProgress: IOSProgress
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//Toast显示位置
|
|
//Toast显示位置
|
|
|
const toastPosition = isIOS ? 0 : -70;
|
|
const toastPosition = isIOS ? 0 : -70;
|
|
|
|
|
|
|
|
|
|
+const getStringMessage = (msg) => {
|
|
|
|
|
+ if (typeof msg == 'object') {
|
|
|
|
|
+ if (msg.err) {
|
|
|
|
|
+ return "" + msg.err;
|
|
|
|
|
+ } else if (msg.msg) {
|
|
|
|
|
+ return "" + msg.msg;
|
|
|
|
|
+ } else if (msg.message) {
|
|
|
|
|
+ return "" + msg.message;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return JSON.stringify(msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return "" + msg;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
export const InitSomething = () => {
|
|
export const InitSomething = () => {
|
|
|
global.dialogId = undefined;
|
|
global.dialogId = undefined;
|
|
|
- global.EndView = () => <View style={ui.end}/>
|
|
|
|
|
|
|
+ global.EndView = () => <View style={andStyles.endView}/>
|
|
|
|
|
|
|
|
global.toastShort = (msg) => {
|
|
global.toastShort = (msg) => {
|
|
|
|
|
+ if (typeof msg !== 'string')
|
|
|
|
|
+ msg = getStringMessage(msg);
|
|
|
if (utils.isNotEmpty(msg)) {
|
|
if (utils.isNotEmpty(msg)) {
|
|
|
- if (typeof msg !== 'string')
|
|
|
|
|
- msg = '' + msg;
|
|
|
|
|
Toast.show(msg, {
|
|
Toast.show(msg, {
|
|
|
duration: Toast.durations.SHORT,
|
|
duration: Toast.durations.SHORT,
|
|
|
position: toastPosition,
|
|
position: toastPosition,
|
|
@@ -423,9 +444,9 @@ export const InitSomething = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
global.toastLong = (msg) => {
|
|
global.toastLong = (msg) => {
|
|
|
|
|
+ if (typeof msg !== 'string')
|
|
|
|
|
+ msg = getStringMessage(msg);
|
|
|
if (utils.isNotEmpty(msg)) {
|
|
if (utils.isNotEmpty(msg)) {
|
|
|
- if (typeof msg !== 'string')
|
|
|
|
|
- msg = '' + msg;
|
|
|
|
|
Toast.show(msg, {
|
|
Toast.show(msg, {
|
|
|
duration: Toast.durations.LONG,
|
|
duration: Toast.durations.LONG,
|
|
|
position: toastPosition,
|
|
position: toastPosition,
|