| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- /* 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 i18n from '../i18n';
- import { navigate } from '../navigation/RootNavigation';
- export function alert(title, content, submitEvent) {
- Modal.alert(
- <Text textAlign="center" fontWeight="bold">
- {title || i18n.t('ti-shi')}
- </Text>,
- <Text fontSize="sm" color="red500" textAlign="center">
- {content}
- </Text>,
- [
- {
- text: i18n.t('qu-xiao'),
- onPress: () => console.log('cancel'),
- style: { color: '#000', fontSize: 12, lineHeight: 30 },
- },
- {
- text: i18n.t('que-ding'),
- onPress: () => {
- if (submitEvent) {
- submitEvent();
- }
- },
- style: { color: '#FFC21C', fontSize: 12, lineHeight: 30 },
- },
- ]
- );
- }
- export function alertWithoutCancel(title, content, isError, submitEvent) {
- Modal.alert(
- !!title && (
- <Text textAlign="center" fontWeight="bold">
- {title || ''}
- </Text>
- ),
- <Text
- fontSize="sm"
- color={isError ? 'red500' : 'gray600'}
- textAlign="center"
- >
- {content}
- </Text>,
- [
- {
- text: i18n.t('que-ding'),
- 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 style={{ marginHorizontal: 15 }} more>
- {i18n.t('tips9')}
- </Text>,
- [
- {
- text: i18n.t('ke-fu-dian-hua'),
- onPress: connectKefuOn,
- style: { color: '#000', fontSize: 12, lineHeight: 30 },
- },
- {
- text: i18n.t('wo-yao-tou-su'),
- 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 || '']
- );
- }
|