From 93546c8d556ad2106339aa940df02a3f798ad325 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Mon, 14 Feb 2022 18:13:22 +0500 Subject: [PATCH] added alert for same username selection --- src/config/locales/en-US.json | 4 +++- src/screens/transfer/screen/delegateScreen.js | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index c04359b2b..1bd72e95e 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -585,7 +585,9 @@ "review": "Review", "confirm": "Confirm Delegation", "confirm_summary": "Delegate {hp} HP ({vests} VESTS) To @{delegator} from @{delegatee} ", - "confirm_summary_para": "This will overwrite your previous delegation of {prev} HP to this user.
" + "confirm_summary_para": "This will overwrite your previous delegation of {prev} HP to this user.", + "username_alert": "Username Error!", + "username_alert_detail": "Please select different username" }, "boost": { "title": "Get Points", diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 64d691682..cd33f2077 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -1,5 +1,5 @@ import React, { Component, Fragment } from 'react'; -import { View, Text, Platform, ScrollView, KeyboardAvoidingView } from 'react-native'; +import { View, Text, Platform, ScrollView, KeyboardAvoidingView, Alert } from 'react-native'; import { WebView } from 'react-native-webview'; import { injectIntl } from 'react-intl'; import Slider from '@esteemapp/react-native-slider'; @@ -237,9 +237,18 @@ class DelegateScreen extends Component { _renderUsersDropdownItem = ({ item }) => { const username = item; + const { from } = this.state; + const { intl } = this.props; return ( { + if (username === from) { + Alert.alert( + intl.formatMessage({ id: 'transfer.username_alert' }), + intl.formatMessage({ id: 'transfer.username_alert_detail' }), + ); + return; + } this._fetchReceivedVestingShare(); this.setState({ destination: username, usersResult: [], step: 2 }); this.destinationTextInput.current?.blur();