@@ -189,19 +189,6 @@ export function SwapFormButton({
189
189
] ,
190
190
)
191
191
192
- const handleOnReviewPress = useCallback ( ( ) => {
193
- // One of these modals may or may not be showing
194
- // If showing, hide
195
- handleHideMaxNativeTransferModal ( )
196
- handleHideTokenWarningModal ( )
197
-
198
- onReviewPress ( {
199
- skipBridgingWarning : false ,
200
- skipMaxTransferWarning : false ,
201
- skipTokenProtectionWarning : false ,
202
- } )
203
- } , [ handleHideMaxNativeTransferModal , handleHideTokenWarningModal , onReviewPress ] )
204
-
205
192
const bridgingModalActionCallback = useCallback (
206
193
( accepted : boolean ) => {
207
194
setShowBridgingWarningModal ( false )
@@ -212,10 +199,6 @@ export function SwapFormButton({
212
199
[ onReviewPress ] ,
213
200
)
214
201
215
- const handleBridgingOnContinue = useCallback ( ( ) => bridgingModalActionCallback ( true ) , [ bridgingModalActionCallback ] )
216
-
217
- const handleBridgingOnClose = useCallback ( ( ) => bridgingModalActionCallback ( false ) , [ bridgingModalActionCallback ] )
218
-
219
202
const invalidTokenSelection = useMemo ( ( ) => Object . values ( currencies ) . some ( ( currency ) => ! currency ) , [ currencies ] )
220
203
const invalidAmountSelection = ! exactAmountFiat && ! exactAmountToken
221
204
@@ -281,11 +264,7 @@ export function SwapFormButton({
281
264
282
265
// If disabled, use defaults for background color
283
266
// Otherwise, we'll try and use the color from the token (i.e. swapping on Web > TDP)
284
- const buttonBackgroundColor = disabled
285
- ? undefined
286
- : ! activeAccount || isSubmitting
287
- ? lightTokenColor
288
- : validTokenColor
267
+ const buttonBackgroundColor = disabled ? undefined : isInactiveAccountOrSubmitting ? lightTokenColor : validTokenColor
289
268
290
269
const buttonVariant : ButtonProps [ 'variant' ] = ! activeAccount
291
270
? 'branded'
@@ -312,7 +291,14 @@ export function SwapFormButton({
312
291
< LowNativeBalanceModal
313
292
isOpen = { showMaxNativeTransferModal }
314
293
onClose = { handleHideMaxNativeTransferModal }
315
- onAcknowledge = { handleOnReviewPress }
294
+ onAcknowledge = { ( ) => {
295
+ handleHideMaxNativeTransferModal ( )
296
+ onReviewPress ( {
297
+ skipBridgingWarning : true ,
298
+ skipTokenProtectionWarning : true ,
299
+ skipMaxTransferWarning : true ,
300
+ } )
301
+ } }
316
302
/>
317
303
< Flex row alignSelf = "stretch" >
318
304
< Button
@@ -323,7 +309,13 @@ export function SwapFormButton({
323
309
backgroundColor = { buttonBackgroundColor }
324
310
size = { isShortMobileDevice ? 'small' : 'large' }
325
311
testID = { TestID . ReviewSwap }
326
- onPress = { handleOnReviewPress }
312
+ onPress = { ( ) =>
313
+ onReviewPress ( {
314
+ skipBridgingWarning : false ,
315
+ skipMaxTransferWarning : false ,
316
+ skipTokenProtectionWarning : false ,
317
+ } )
318
+ }
327
319
>
328
320
{ buttonTextColor ? (
329
321
< Button . Text customBackgroundColor = { buttonBackgroundColor } color = { buttonTextColor } >
@@ -339,16 +331,23 @@ export function SwapFormButton({
339
331
< BridgingModal
340
332
isOpen = { showBridgingWarningModal }
341
333
derivedSwapInfo = { derivedSwapInfo }
342
- onContinue = { handleBridgingOnContinue }
343
- onClose = { handleBridgingOnClose }
334
+ onContinue = { ( ) => bridgingModalActionCallback ( true ) }
335
+ onClose = { ( ) => bridgingModalActionCallback ( false ) }
344
336
/>
345
337
{ currenciesWithProtectionWarnings . length > 0 && currenciesWithProtectionWarnings [ 0 ] && (
346
338
< TokenWarningModal
347
339
isVisible = { showTokenWarningModal }
348
340
currencyInfo0 = { currenciesWithProtectionWarnings [ 0 ] }
349
341
currencyInfo1 = { currenciesWithProtectionWarnings . length > 1 ? currenciesWithProtectionWarnings [ 1 ] : undefined }
350
342
closeModalOnly = { handleHideTokenWarningModal }
351
- onAcknowledge = { handleOnReviewPress }
343
+ onAcknowledge = { ( ) => {
344
+ handleHideTokenWarningModal ( )
345
+ onReviewPress ( {
346
+ skipBridgingWarning : false ,
347
+ skipMaxTransferWarning : false ,
348
+ skipTokenProtectionWarning : true ,
349
+ } )
350
+ } }
352
351
/>
353
352
) }
354
353
</ Flex >
0 commit comments