From ce5247194115c8daf72c04b564b8a58bcca1921e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Wed, 23 Aug 2023 12:18:22 +0200 Subject: [PATCH] Fix add contact from HomeScreen Error --- ComApp/src/App/Views/ContactScreen.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ComApp/src/App/Views/ContactScreen.js b/ComApp/src/App/Views/ContactScreen.js index 3b69040..1df1ce5 100644 --- a/ComApp/src/App/Views/ContactScreen.js +++ b/ComApp/src/App/Views/ContactScreen.js @@ -312,6 +312,13 @@ class ContactScreen extends React.Component { return objDocs[key]; }); + const { action } = this.props.route.params; + if (action === 'add') { + this.props.navigation.navigate('ContactDetailsScreen', { + action: 'add', + }); + } + this.setState({ contacts: arrayContacts.sort(Helpers.compareValues('name', 'asc')), sortedDocuments: arrayDocs.sort(Helpers.compareValues('title', 'asc')), @@ -322,12 +329,8 @@ class ContactScreen extends React.Component { } render() { - const { contactAdded, action } = this.props.route.params; - if (action === 'add') { - this.props.navigation.navigate('ContactDetailsScreen', { - action: 'add', - }); - } + const { contactAdded } = this.props.route.params; + if (contactAdded === true) { this.props.navigation.setParams({ contactAdded: false }); showMessage({