Skip to content

Commit c3b90a6

Browse files
[SDK] fix: Handle comma decimal input in PayEmbed (#6386)
1 parent 323e9d7 commit c3b90a6

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

.changeset/mean-animals-eat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Handle comma for decimal input in PayEmbed

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,9 @@ function SelectedTokenInfo(props: {
654654
onChange={(e) => {
655655
let value = e.target.value;
656656

657+
// Replace comma with period if it exists
658+
value = value.replace(",", ".");
659+
657660
if (value.startsWith(".")) {
658661
value = `0${value}`;
659662
}

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ export function BuyTokenInput(props: {
7373
onChange={(e) => {
7474
let value = e.target.value;
7575

76+
// Replace comma with period if it exists
77+
value = value.replace(",", ".");
78+
7679
if (value.startsWith(".")) {
7780
value = `0${value}`;
7881
}

0 commit comments

Comments
 (0)