Skip to content

Commit

Permalink
Merge pull request #1107 from gabrielbazan7/ref/verifyphrase
Browse files Browse the repository at this point in the history
[REF] trim word before validation and state update
  • Loading branch information
JohnathanWhite authored Apr 9, 2024
2 parents e06938f + dda979a commit 9f4515b
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/navigation/wallet/screens/VerifyPhrase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,10 @@ const VerifyPhrase: React.FC<VerifyPhraseScreenProps> = ({route}) => {
disabled={word1Validation}
autoCorrect={false}
onChangeText={async (newValue: string) => {
field.onChange(newValue);
if (checkValidWord(newValue, 0)) {
setValue('word1', newValue);
const trimmedValue = newValue.trim();
field.onChange(trimmedValue);
if (checkValidWord(trimmedValue, 0)) {
setValue('word1', trimmedValue);
setWord1Validation(true);
}
}}
Expand All @@ -352,9 +353,10 @@ const VerifyPhrase: React.FC<VerifyPhraseScreenProps> = ({route}) => {
disabled={word2Validation}
autoCorrect={false}
onChangeText={async (newValue: string) => {
field.onChange(newValue);
if (checkValidWord(newValue, 1)) {
setValue('word2', newValue);
const trimmedValue = newValue.trim();
field.onChange(trimmedValue);
if (checkValidWord(trimmedValue, 1)) {
setValue('word2', trimmedValue);
setWord2Validation(true);
}
}}
Expand All @@ -380,9 +382,10 @@ const VerifyPhrase: React.FC<VerifyPhraseScreenProps> = ({route}) => {
disabled={word3Validation}
autoCorrect={false}
onChangeText={async (newValue: string) => {
field.onChange(newValue);
if (checkValidWord(newValue, 2)) {
setValue('word3', newValue);
const trimmedValue = newValue.trim();
field.onChange(trimmedValue);
if (checkValidWord(trimmedValue, 2)) {
setValue('word3', trimmedValue);
setWord3Validation(true);
}
}}
Expand Down

0 comments on commit 9f4515b

Please sign in to comment.