Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes fee re-calculation on amount change #218

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/screens/Payment/SelectAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ export default function SelectAmountScreen({ navigation, route }: TSelectAmountP
// check if is melting process
useEffect(() => setShouldEstimate(!isSendEcash), [isSendEcash])

// estimate fee each time the melt amount changes
// estimate fee each time the melt or swap amount changes
useEffect(() => {
if (!isMelt || !isSwap) { return }
if (isSendEcash) { return }
setFee({ estimation: 0, isCalculating: false })
setShouldEstimate(true)
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down Expand Up @@ -191,6 +191,7 @@ export default function SelectAmountScreen({ navigation, route }: TSelectAmountP
maxLength={8}
/>
</Animated.View>
<Txt txt='Satoshi' styles={[{ color: color.TEXT_SECONDARY, fontSize: 14, textAlign: 'center' }]} />
{(isMelt || isSwap || isSendEcash) &&
<Separator style={[{ marginVertical: 20 }]} />
}
Expand Down Expand Up @@ -256,6 +257,7 @@ interface IMeltOverviewProps {
export function MeltOverview({ amount, balance, shouldEstimate, balTooLow, isInvoice, fee }: IMeltOverviewProps) {
const { t } = useTranslation([NS.common])
const { color } = useThemeContext()
l({ fee })
return (
<>
<View style={styles.overview}>
Expand Down
Loading