/* eslint-disable no-use-before-define */
/* eslint-disable no-console */
import React from 'react';
import { Modal } from '@ant-design/react-native';
import { Text } from 'react-native-magnus';
import * as Linking from 'expo-linking';
import { navigate } from '../navigation/RootNavigation';
export function alert(title, content, submitEvent) {
Modal.alert(
{title || '提示'}
,
{content}
,
[
{
text: '取消',
onPress: () => console.log('cancel'),
style: { color: '#000', fontSize: 12, lineHeight: 30 },
},
{
text: '确定',
onPress: () => {
if (submitEvent) {
submitEvent();
}
},
style: { color: '#FFC21C', fontSize: 12, lineHeight: 30 },
},
]
);
}
export function alertWithoutCancel(title, content, isError, submitEvent) {
Modal.alert(
!!title && (
{title || ''}
),
{content}
,
[
{
text: '确定',
onPress: () => {
if (submitEvent) {
submitEvent();
}
},
style: { color: '#FFC21C', fontSize: 12, lineHeight: 30 },
},
]
);
}
export function operation() {
Modal.operation([
{ text: '标为未读', onPress: () => console.log('标为未读被点击了') },
{ text: '置顶聊天', onPress: () => console.log('置顶聊天被点击了') },
]);
}
export function connectKefu(orderId) {
Modal.alert(
'',
感谢您对我们的信任,我们将竭尽所能
的为您解决问题。您的每一个建议和反馈都对我们至关重要
,
[
{
text: '客服电话',
onPress: connectKefuOn,
style: { color: '#000', fontSize: 12, lineHeight: 30 },
},
{
text: '我要投诉',
onPress: () => {
navigate('Complaint', { orderId });
},
style: { color: '#FFC21C', fontSize: 12, lineHeight: 30 },
},
]
);
}
export function connectKefuOn() {
Linking.openURL('tel:+123456789');
}
export function prompt(title, plac, defaultValue, callBack) {
Modal.prompt(
title || '',
'',
(val) => {
if (callBack) callBack(val);
},
'default',
defaultValue || '',
[plac || '']
);
}