@@ -16,6 +16,7 @@ import {
1616 ButtonSize ,
1717 ButtonVariant ,
1818 FontWeight ,
19+ HeaderStandard ,
1920 Icon ,
2021 IconColor ,
2122 IconName ,
@@ -27,7 +28,6 @@ import {
2728import { formatChainIdToCaip } from '@metamask/bridge-controller' ;
2829import { CaipChainId } from '@metamask/utils' ;
2930
30- import { getHeaderCompactStandardNavbarOptions } from '../../../../../component-library/components-temp/HeaderCompactStandard' ;
3131import { strings } from '../../../../../../locales/i18n' ;
3232import Routes from '../../../../../constants/navigation/Routes' ;
3333import {
@@ -75,16 +75,6 @@ export function BatchSellTokenSelect() {
7575 > ( ( ) => sortedEligibleChains [ 0 ] ?. chainId ) ;
7676 const [ selectedTokens , setSelectedTokens ] = useState < BridgeToken [ ] > ( [ ] ) ;
7777
78- useEffect ( ( ) => {
79- navigation . setOptions (
80- getHeaderCompactStandardNavbarOptions ( {
81- title : '' ,
82- onBack : ( ) => navigation . goBack ( ) ,
83- includesTopInset : true ,
84- } ) ,
85- ) ;
86- } , [ navigation ] ) ;
87-
8878 // Start each Batch Sell flow from a clean Redux handoff state.
8979 useEffect ( ( ) => {
9080 dispatch ( setBatchSellSourceTokens ( [ ] ) ) ;
@@ -160,6 +150,10 @@ export function BatchSellTokenSelect() {
160150 return strings ( 'bridge.next' ) ;
161151 } , [ selectedTokenCount ] ) ;
162152
153+ const handleBackPress = useCallback ( ( ) => {
154+ navigation . goBack ( ) ;
155+ } , [ navigation ] ) ;
156+
163157 const handleChainSelect = useCallback (
164158 ( chainId ?: CaipChainId ) => {
165159 if ( chainId !== selectedChainId ) {
@@ -311,95 +305,106 @@ export function BatchSellTokenSelect() {
311305 [ handleTokenPress , selectedTokenKeys , sortedEligibleChains ] ,
312306 ) ;
313307
314- if ( sortedEligibleChains . length === 0 ) {
315- return (
316- < BatchSellEmptyState onExploreTokensPress = { handleExploreTokensPress } />
317- ) ;
318- }
319-
320308 return (
321- < SafeAreaView style = { tw . style ( 'flex-1 bg-default' ) } edges = { [ 'bottom' ] } >
309+ < SafeAreaView
310+ style = { tw . style ( 'flex-1 bg-default' ) }
311+ edges = { [ 'bottom' , 'left' , 'right' ] }
312+ >
322313 < Box twClassName = "flex-1" >
323- < Box twClassName = "px-4 pt-2" >
324- < Text variant = { TextVariant . HeadingLg } color = { TextColor . TextDefault } >
325- { strings ( 'bridge.batch_sell_select_title' ) }
326- </ Text >
327- < Text
328- variant = { TextVariant . BodyMd }
329- color = { TextColor . TextAlternative }
330- twClassName = "mt-1"
331- >
332- { strings ( 'bridge.batch_sell_select_subtitle' ) }
333- </ Text >
334- </ Box >
335- < Box twClassName = "pt-4 pl-4" >
336- < ScrollView
337- horizontal
338- showsHorizontalScrollIndicator = { false }
339- contentContainerStyle = { tw . style ( 'flex-row items-center gap-2 pr-4' ) }
340- >
341- { sortedEligibleChains . map ( ( network ) =>
342- renderNetworkPill (
343- network . chainId ,
344- network . name ,
345- activeChainId === network . chainId ,
346- ) ,
347- ) }
348- </ ScrollView >
349- </ Box >
350- < Box
351- flexDirection = { BoxFlexDirection . Row }
352- alignItems = { BoxAlignItems . Center }
353- twClassName = "px-4 py-4"
354- >
355- < Pressable
356- accessibilityRole = "button"
357- onPress = { handleTokenSortToggle }
358- testID = { BatchSellTokenSelectSelectorsIDs . BALANCE_SORT_BUTTON }
359- >
360- < Box
361- flexDirection = { BoxFlexDirection . Row }
362- alignItems = { BoxAlignItems . Center }
363- gap = { 1 }
364- >
314+ < HeaderStandard title = "" onBack = { handleBackPress } includesTopInset />
315+ { sortedEligibleChains . length === 0 ? (
316+ < BatchSellEmptyState
317+ onExploreTokensPress = { handleExploreTokensPress }
318+ />
319+ ) : (
320+ < >
321+ < Box twClassName = "px-4 pt-2" >
322+ < Text
323+ variant = { TextVariant . HeadingLg }
324+ color = { TextColor . TextDefault }
325+ >
326+ { strings ( 'bridge.batch_sell_select_title' ) }
327+ </ Text >
365328 < Text
366329 variant = { TextVariant . BodyMd }
367330 color = { TextColor . TextAlternative }
331+ twClassName = "mt-1"
368332 >
369- { strings ( 'bridge.sort_balance ' ) }
333+ { strings ( 'bridge.batch_sell_select_subtitle ' ) }
370334 </ Text >
371- < Icon
372- name = {
373- tokenSortDirection === 'desc'
374- ? IconName . Arrow2Down
375- : IconName . Arrow2Up
376- }
377- size = { IconSize . Sm }
378- color = { IconColor . IconAlternative }
379- />
380335 </ Box >
381- </ Pressable >
382- </ Box >
383- < FlatList
384- testID = { BatchSellTokenSelectSelectorsIDs . TOKEN_LIST }
385- data = { selectedChainTokens }
386- renderItem = { renderToken }
387- keyExtractor = { getTokenKey }
388- showsVerticalScrollIndicator = { false }
389- contentContainerStyle = { tw . style ( 'pb-4' ) }
390- />
391- < Box twClassName = "border-t border-muted px-4 pb-4 pt-3" >
392- < Button
393- variant = { ButtonVariant . Primary }
394- size = { ButtonSize . Lg }
395- isFullWidth
396- isDisabled = { isPrimaryButtonDisabled }
397- onPress = { handleNextPress }
398- testID = { BatchSellTokenSelectSelectorsIDs . NEXT_BUTTON }
399- >
400- { primaryButtonLabel }
401- </ Button >
402- </ Box >
336+ < Box twClassName = "pt-4 pl-4" >
337+ < ScrollView
338+ horizontal
339+ showsHorizontalScrollIndicator = { false }
340+ contentContainerStyle = { tw . style (
341+ 'flex-row items-center gap-2 pr-4' ,
342+ ) }
343+ >
344+ { sortedEligibleChains . map ( ( network ) =>
345+ renderNetworkPill (
346+ network . chainId ,
347+ network . name ,
348+ activeChainId === network . chainId ,
349+ ) ,
350+ ) }
351+ </ ScrollView >
352+ </ Box >
353+ < Box
354+ flexDirection = { BoxFlexDirection . Row }
355+ alignItems = { BoxAlignItems . Center }
356+ twClassName = "px-4 py-4"
357+ >
358+ < Pressable
359+ accessibilityRole = "button"
360+ onPress = { handleTokenSortToggle }
361+ testID = { BatchSellTokenSelectSelectorsIDs . BALANCE_SORT_BUTTON }
362+ >
363+ < Box
364+ flexDirection = { BoxFlexDirection . Row }
365+ alignItems = { BoxAlignItems . Center }
366+ gap = { 1 }
367+ >
368+ < Text
369+ variant = { TextVariant . BodyMd }
370+ color = { TextColor . TextAlternative }
371+ >
372+ { strings ( 'bridge.sort_balance' ) }
373+ </ Text >
374+ < Icon
375+ name = {
376+ tokenSortDirection === 'desc'
377+ ? IconName . Arrow2Down
378+ : IconName . Arrow2Up
379+ }
380+ size = { IconSize . Sm }
381+ color = { IconColor . IconAlternative }
382+ />
383+ </ Box >
384+ </ Pressable >
385+ </ Box >
386+ < FlatList
387+ testID = { BatchSellTokenSelectSelectorsIDs . TOKEN_LIST }
388+ data = { selectedChainTokens }
389+ renderItem = { renderToken }
390+ keyExtractor = { getTokenKey }
391+ showsVerticalScrollIndicator = { false }
392+ contentContainerStyle = { tw . style ( 'pb-4' ) }
393+ />
394+ < Box twClassName = "border-t border-muted px-4 pb-4 pt-3" >
395+ < Button
396+ variant = { ButtonVariant . Primary }
397+ size = { ButtonSize . Lg }
398+ isFullWidth
399+ isDisabled = { isPrimaryButtonDisabled }
400+ onPress = { handleNextPress }
401+ testID = { BatchSellTokenSelectSelectorsIDs . NEXT_BUTTON }
402+ >
403+ { primaryButtonLabel }
404+ </ Button >
405+ </ Box >
406+ </ >
407+ ) }
403408 </ Box >
404409 </ SafeAreaView >
405410 ) ;
0 commit comments