Use Alert.alert instead of basic js alert

This commit is contained in:
Vincent BRIDIER 2022-09-30 15:17:12 +02:00
parent 7c2a76c4ed
commit 24ef2334f7
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
2 changed files with 7 additions and 6 deletions

View file

@ -1,3 +1,4 @@
import { Alert } from "react-native";
// Lodash
import _ from 'lodash';
// Http Client
@ -47,16 +48,16 @@ class InstallController {
}
});
} else {
alert(i18n.t("error.error_has_occurred"));
Alert.alert(i18n.t("error.error"), i18n.t("error.error_has_occurred"));
}
}
})
.catch(function (error) {
console.log(error)
alert(i18n.t("error.error_has_occurred"));
Alert.alert(i18n.t("error.error"), i18n.t("error.error_has_occurred"));
})
} else {
alert(i18n.t("error.tablet_not_connected_internet"));
Alert.alert(i18n.t("error.error"), i18n.t("error.tablet_not_connected_internet"));
}
});
}

View file

@ -1,5 +1,5 @@
import React from 'react';
import { ImageBackground, View, Image, TextInput, Button, StyleSheet } from 'react-native';
import { ImageBackground, View, Image, TextInput, Button, StyleSheet, Alert } from 'react-native';
// Helpers
import Helpers from '../Lib/Helpers';
// Common Styles
@ -31,12 +31,12 @@ class InstallScreen extends React.Component {
title={ i18n.t('install.install')}
onPress={() => {
if (this.state.url.length === 0) {
alert(i18n.t("install.enter_url"));
Alert.alert(i18n.t("error.error"), i18n.t("install.enter_url"));
} else {
if (Helpers.isUrlValid(this.state.url)) {
InstallController.getConfig(this.state.url);
} else {
alert(i18n.t("install.url_invalid"));
Alert.alert(i18n.t("error.error"), i18n.t("install.url_invalid"));
}
}
}}