Skip to content

Commit

Permalink
fix(wallet-mobile): autofocus and caret color for send edit amount (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jorbuedo authored Oct 17, 2024
1 parent bc0ae2b commit 944bf3f
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ export const EditAmountScreen = () => {

const [quantity, setQuantity] = React.useState(initialQuantity)
const [inputValue, setInputValue] = React.useState(
atomicBreakdown(initialQuantity, amount.info.decimals).bn.toFormat(),
initialQuantity === 0n ? '' : atomicBreakdown(initialQuantity, amount.info.decimals).bn.toFormat(),
)
const spendable = isPrimary ? available - primaryBreakdown.lockedAsStorageCost : available

useOverridePreviousSendTxRoute(initialQuantity === 0n ? 'send-select-token-from-list' : 'send-list-amounts-to-send')

React.useEffect(() => {
setQuantity(initialQuantity)
setInputValue(atomicBreakdown(initialQuantity, amount.info.decimals).bn.toFormat())
setInputValue(initialQuantity === 0n ? '' : atomicBreakdown(initialQuantity, amount.info.decimals).bn.toFormat())
}, [amount.info.decimals, initialQuantity])

const isFocused = useIsFocused()
Expand Down Expand Up @@ -216,6 +216,7 @@ const AmountInput = ({onChange, value, ticker}: AmountInputProps) => {
underlineColorAndroid="transparent"
activeUnderlineColor="transparent"
selectionColor={colors.selected}
cursorColor={colors.cursor}
noHelper
/>
)
Expand Down Expand Up @@ -272,7 +273,7 @@ const useStyles = () => {
},
})
const colors = {
black: color.gray_max,
cursor: color.el_gray_max,
selected: color.input_selected,
}
return {styles, colors} as const
Expand Down

0 comments on commit 944bf3f

Please sign in to comment.