From 24ef2334f7ec9cc264f3bd35d1b1e465c70e9485 Mon Sep 17 00:00:00 2001 From: Vincent BRIDIER Date: Fri, 30 Sep 2022 15:17:12 +0200 Subject: [PATCH] Use Alert.alert instead of basic js alert --- ComApp/src/App/Controllers/InstallController.js | 7 ++++--- ComApp/src/App/Views/InstallScreen.js | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ComApp/src/App/Controllers/InstallController.js b/ComApp/src/App/Controllers/InstallController.js index 3d332bc..79a8fba 100644 --- a/ComApp/src/App/Controllers/InstallController.js +++ b/ComApp/src/App/Controllers/InstallController.js @@ -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")); } }); } diff --git a/ComApp/src/App/Views/InstallScreen.js b/ComApp/src/App/Views/InstallScreen.js index b08e32b..b60fce9 100644 --- a/ComApp/src/App/Views/InstallScreen.js +++ b/ComApp/src/App/Views/InstallScreen.js @@ -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")); } } }}