Skip to content

Commit 3542d66

Browse files
chore(runway): cherry-pick fix: Bridge long token values show the right hand side, make it show the left (#15517)
- fix: Bridge long token values show the right hand side, make it show the left (#15335)
1 parent 41752b4 commit 3542d66

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

app/components/UI/Bridge/Views/BridgeView/__snapshots__/BridgeView.test.tsx.snap

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,12 @@ exports[`BridgeView Bottom Content blurs input when opening QuoteExpiredModal 1`
399399
onBlur={[Function]}
400400
onFocus={[Function]}
401401
placeholder="0"
402+
selection={
403+
{
404+
"end": 0,
405+
"start": 0,
406+
}
407+
}
402408
showSoftInputOnFocus={false}
403409
style={
404410
{
@@ -782,6 +788,12 @@ exports[`BridgeView Bottom Content blurs input when opening QuoteExpiredModal 1`
782788
onBlur={[Function]}
783789
onFocus={[Function]}
784790
placeholder="0"
791+
selection={
792+
{
793+
"end": 0,
794+
"start": 0,
795+
}
796+
}
785797
showSoftInputOnFocus={false}
786798
style={
787799
{
@@ -1353,6 +1365,12 @@ exports[`BridgeView renders 1`] = `
13531365
onBlur={[Function]}
13541366
onFocus={[Function]}
13551367
placeholder="0"
1368+
selection={
1369+
{
1370+
"end": 0,
1371+
"start": 0,
1372+
}
1373+
}
13561374
showSoftInputOnFocus={false}
13571375
style={
13581376
{
@@ -1736,6 +1754,12 @@ exports[`BridgeView renders 1`] = `
17361754
onBlur={[Function]}
17371755
onFocus={[Function]}
17381756
placeholder="0"
1757+
selection={
1758+
{
1759+
"end": 0,
1760+
"start": 0,
1761+
}
1762+
}
17391763
showSoftInputOnFocus={false}
17401764
style={
17411765
{

app/components/UI/Bridge/components/TokenInputArea/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ import { selectMultichainAssetsRates } from '../../../../../selectors/multichain
3434
///: END:ONLY_INCLUDE_IF(keyring-snaps)
3535
import { getDisplayCurrencyValue } from '../../utils/exchange-rates';
3636
import { useBridgeExchangeRates } from '../../hooks/useBridgeExchangeRates';
37+
import parseAmount from '../../../Ramp/utils/parseAmount';
3738
import useIsInsufficientBalance from '../../hooks/useInsufficientBalance';
3839

40+
const MAX_DECIMALS = 5;
41+
3942
const createStyles = () =>
4043
StyleSheet.create({
4144
content: {
@@ -188,7 +191,7 @@ export const TokenInputArea = forwardRef<
188191
) : (
189192
<Input
190193
ref={inputRef}
191-
value={amount}
194+
value={amount ? parseAmount(amount, MAX_DECIMALS) : amount}
192195
style={styles.input}
193196
isDisabled={false}
194197
isReadonly={tokenType === TokenInputAreaType.Destination}
@@ -204,6 +207,9 @@ export const TokenInputArea = forwardRef<
204207
onBlur={() => {
205208
onBlur?.();
206209
}}
210+
// Android only issue, for long numbers, the input field will focus on the right hand side
211+
// Force it to focus on the left hand side
212+
selection={{ start: 0, end: 0 }}
207213
/>
208214
)}
209215
</Box>

0 commit comments

Comments
 (0)