verdnatura-chat/app/utils/info.js

27 lines
615 B
JavaScript
Raw Normal View History

2019-07-23 14:02:57 +00:00
import { Alert } from 'react-native';
import I18n from '../i18n';
2018-01-15 20:43:52 +00:00
export const showErrorAlert = (message, title, onPress = () => {}) => Alert.alert(title, message, [{ text: 'OK', onPress }], { cancelable: true });
export const showConfirmationAlert = ({
title, message, confirmationText, dismissText = I18n.t('Cancel'), onPress, onCancel
}) => (
Alert.alert(
title || I18n.t('Are_you_sure_question_mark'),
message,
[
{
text: dismissText,
onPress: onCancel,
style: 'cancel'
},
{
text: confirmationText,
style: 'destructive',
onPress
}
],
{ cancelable: false }
)
);