Skip to content

Commit

Permalink
fix: Fix mnemonic handling on the Import Wallet screen (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinoosss authored Mar 15, 2024
1 parent 3cde331 commit aa9e117
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ export const WebSeedInput = ({ errorMessage, onChange }: WebSeedInputProps): Rea
[type, wordList],
);

const onChangeWebSeedInputByWords = useCallback(
(value: string) => {
const words = _getFilledWordList(type, value.split(' '));
setWordList(words);
onChange({ type, value: words.join(' ') });
},
[type],
);

const TypeMenuItem = useCallback(
({ title, _type }: { title: string; _type: WebSeedInputType }): ReactElement => {
const selected = type === _type;
Expand Down Expand Up @@ -130,8 +139,7 @@ export const WebSeedInput = ({ errorMessage, onChange }: WebSeedInputProps): Rea
error={!!errorMessage}
onChange={(value: string): void => {
if (index === 0 && value.split(' ').length > 1) {
setWordList(value.split(' '));
onChange({ type, value });
onChangeWebSeedInputByWords(value);
} else {
onChangeWord(index, value);
}
Expand Down

0 comments on commit aa9e117

Please sign in to comment.