From 835d0ff748a0c6009511b069e697ca86ef4ad374 Mon Sep 17 00:00:00 2001 From: minibits-cash Date: Tue, 19 Aug 2025 23:49:16 +0200 Subject: [PATCH] Fix initial conversion on screen load --- android/app/build.gradle | 2 +- package.json | 2 +- src/components/AmountInput.tsx | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 3d9b1dc4..a9894c31 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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" } diff --git a/package.json b/package.json index ecae0aa2..609b4304 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/AmountInput.tsx b/src/components/AmountInput.tsx index 90f036cb..af22a83f 100644 --- a/src/components/AmountInput.tsx +++ b/src/components/AmountInput.tsx @@ -57,6 +57,7 @@ export const AmountInput = forwardRef( const [isConvertedValueVisible, setIsConvertedValueVisible] = useState(false) const [hasTopAmountFocusedOnce, setHasTopAmountFocusedOnce] = useState(false) const [hasBottomAmountFocusedOnce, setHasBottomAmountFocusedOnce] = useState(false) + const [hasBeenFirstTimeConverted, setHasBeenFirstTimeConverted] = useState(false) const amountInputColor = useThemeColor("amountInput") const convertedAmountColor = useThemeColor("headerSubTitle") @@ -153,13 +154,16 @@ export const AmountInput = forwardRef( } 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)