added alert for same username selection

This commit is contained in:
Sadaqat Ali 2022-02-14 18:13:22 +05:00
parent 3442e12e24
commit 93546c8d55
2 changed files with 13 additions and 2 deletions

View File

@ -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",

View File

@ -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 (
<TouchableOpacity
onPress={() => {
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();