@@ -40,9 +40,9 @@ export default function DonatePopup() {
40
40
const { t } = useTranslation ( ) ;
41
41
const { visible, hideDonatePopup } = useDonatePopupStore ( ) ;
42
42
const [ currency , setCurrency ] = useState < ICurrency > ( ) ;
43
- const [ amount , setAmount ] = useState ( "" ) ;
43
+ const [ amount , setAmount ] = useState ( { rawText : "" , text : "" } ) ;
44
44
const validAmount = currency
45
- ? Number . parseFloat ( amount ) >= currency . minimum
45
+ ? Number . parseFloat ( amount . text ) >= currency . minimum
46
46
: false ;
47
47
const { user } = useUserStore ( ) ;
48
48
const { initPaymentSheet, presentPaymentSheet } = useStripe ( ) ;
@@ -51,7 +51,7 @@ export default function DonatePopup() {
51
51
52
52
const initializePaymentSheet = async ( ) => {
53
53
const res = await generatePaymentSheet ( {
54
- amount : Number . parseFloat ( amount ) ,
54
+ amount : Number . parseFloat ( amount . text ) ,
55
55
riotId : user . id ,
56
56
currencyCode : currency ?. code . toLowerCase ( ) ?? "" ,
57
57
} ) ;
@@ -139,8 +139,6 @@ export default function DonatePopup() {
139
139
</ View >
140
140
< Paragraph > { t ( "donate_msg" ) } </ Paragraph >
141
141
< TextInput
142
- value = { amount }
143
- onChangeText = { ( value ) => setAmount ( value ) }
144
142
left = {
145
143
< TextInput . Affix
146
144
text = { currency ?. symbol }
@@ -153,11 +151,10 @@ export default function DonatePopup() {
153
151
render = { ( props ) => (
154
152
< MaskedTextInput
155
153
{ ...props }
156
- onChangeText = { ( text , rawText ) => {
157
- if ( props . onChangeText ) {
158
- props . onChangeText ( rawText ) ;
159
- }
160
- } }
154
+ value = { amount . rawText }
155
+ onChangeText = { ( text , rawText ) =>
156
+ setAmount ( { text, rawText } )
157
+ }
161
158
type = "currency"
162
159
options = { {
163
160
decimalSeparator : ! currency ?. zeroDecimal && "." ,
@@ -190,7 +187,7 @@ export default function DonatePopup() {
190
187
< Button onPress = { hideDonatePopup } > { t ( "no" ) } </ Button >
191
188
< Button
192
189
onPress = { openPaymentSheet }
193
- disabled = { ! currency || ! validAmount || amount . length === 0 }
190
+ disabled = { ! currency || ! validAmount || amount . text . length === 0 }
194
191
>
195
192
{ t ( "donate" ) }
196
193
</ Button >
0 commit comments