Skip to content

Commit

Permalink
fix(components): token input items
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsimao committed May 7, 2024
1 parent f91d6a3 commit f4b8d07
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/components/src/TokenInput/TokenInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,26 @@ const TokenInput = forwardRef<HTMLInputElement, TokenInputProps>((props, ref): J

const inputRef = useDOMRef<HTMLInputElement>(ref);

const defaultCurrency = useMemo(() => getDefaultCurrency(props), []);

const [value, setValue] = useState(defaultValue);

const defaultCurrency = useMemo(() => getDefaultCurrency(props), []);
const [currency, setCurrency] = useState<any | undefined>(defaultCurrency);

const inputId = useId();

useEffect(
() => {
if (props.type === 'selectable') {
setCurrency(
(props.items || []).find(
(item) => item.currency.symbol === (props.selectProps?.value || props.selectProps?.defaultValue)
)?.currency
);
}
},
props.type === 'selectable' ? [props.items] : []
);

useEffect(() => {
if (valueProp === undefined) return;

Expand Down

0 comments on commit f4b8d07

Please sign in to comment.