mirror of
https://github.com/minibits-cash/minibits_wallet.git
synced 2026-10-05 19:28:26 +00:00
Fix initial conversion on screen load
This commit is contained in:
@@ -95,7 +95,7 @@ android {
|
||||
applicationId "com.minibits_wallet"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 58044
|
||||
versionCode 58045
|
||||
versionName "0.3.0"
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "minibits_wallet",
|
||||
"version": "0.3.0-beta.3",
|
||||
"version": "0.3.0-beta.5",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"android:clean": "cd android && ./gradlew clean",
|
||||
|
||||
@@ -57,6 +57,7 @@ export const AmountInput = forwardRef<TextInput, AmountInputProps>(
|
||||
const [isConvertedValueVisible, setIsConvertedValueVisible] = useState<boolean>(false)
|
||||
const [hasTopAmountFocusedOnce, setHasTopAmountFocusedOnce] = useState(false)
|
||||
const [hasBottomAmountFocusedOnce, setHasBottomAmountFocusedOnce] = useState(false)
|
||||
const [hasBeenFirstTimeConverted, setHasBeenFirstTimeConverted] = useState<boolean>(false)
|
||||
|
||||
const amountInputColor = useThemeColor("amountInput")
|
||||
const convertedAmountColor = useThemeColor("headerSubTitle")
|
||||
@@ -153,13 +154,16 @@ export const AmountInput = forwardRef<TextInput, AmountInputProps>(
|
||||
} else {
|
||||
setBottomValue("0")
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
log.trace(`[useEffect] setTopValue call`, value)
|
||||
setTopValue(value)
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
if(!hasBeenFirstTimeConverted && value && toNumber(value) > 0) {
|
||||
setBottomValue(recalcBottom(value))
|
||||
setHasBeenFirstTimeConverted(true)
|
||||
}
|
||||
|
||||
}, [value])
|
||||
|
||||
// input change handlers (bi-directional)
|
||||
|
||||
Reference in New Issue
Block a user