Skip to content

Commit 03a9b04

Browse files
committed
fix: allow tapping empty source amount area to focus input
1 parent e108efc commit 03a9b04

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • app/components/UI/Bridge/Views/BridgeView

app/components/UI/Bridge/Views/BridgeView/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ const BridgeViewContent = ({ latestSourceBalance }: BridgeViewContentProps) => {
178178
sourceToken,
179179
onSourceAmountChange: handleSourceAmountChange,
180180
});
181+
const { resetToTokenMode, syncFiatAmountToTokenAmount } = sourceAmountInput;
181182

182183
/** The entry point location for analytics (e.g. Main View, Token View, Trending Explore) */
183184
const location = route.params?.location;
@@ -339,7 +340,7 @@ const BridgeViewContent = ({ latestSourceBalance }: BridgeViewContentProps) => {
339340
balance,
340341
MAX_INPUT_LENGTH,
341342
);
342-
sourceAmountInput.syncFiatAmountToTokenAmount(cleaned);
343+
syncFiatAmountToTokenAmount(cleaned);
343344
dispatch(setSourceAmountAsMax(cleaned));
344345
}
345346
};
@@ -350,10 +351,10 @@ const BridgeViewContent = ({ latestSourceBalance }: BridgeViewContentProps) => {
350351
// current cursor position, so clear the cursor state before updating.
351352
const normalizedValue =
352353
normalizeSourceAmountToMaxLength(value, MAX_INPUT_LENGTH) || undefined;
353-
sourceAmountInput.syncFiatAmountToTokenAmount(normalizedValue);
354+
syncFiatAmountToTokenAmount(normalizedValue);
354355
dispatch(setSourceAmount(normalizedValue));
355356
},
356-
[dispatch, sourceAmountInput],
357+
[dispatch, syncFiatAmountToTokenAmount],
357358
);
358359

359360
const handleSourceTokenPress = () =>
@@ -362,9 +363,9 @@ const BridgeViewContent = ({ latestSourceBalance }: BridgeViewContentProps) => {
362363
});
363364

364365
const handleFlipTokensPress = useCallback(() => {
365-
sourceAmountInput.resetToTokenMode();
366+
resetToTokenMode();
366367
handleSwitchTokens(destTokenAmount)();
367-
}, [destTokenAmount, handleSwitchTokens, sourceAmountInput]);
368+
}, [destTokenAmount, handleSwitchTokens, resetToTokenMode]);
368369

369370
const handleDestTokenPress = () =>
370371
navigation.navigate(Routes.BRIDGE.TOKEN_SELECTOR, {

0 commit comments

Comments
 (0)