Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion app/components/UI/AssetOverview/AssetOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ const AssetOverview: React.FC<AssetOverviewProps> = ({
dispatch(newAssetTransaction(asset));
}

navigateToSendPage(InitSendLocation.AssetOverview, asset);
navigateToSendPage({ location: InitSendLocation.AssetOverview, asset });
};

const onBuy = () => {
Expand Down
5 changes: 4 additions & 1 deletion app/components/UI/CollectibleModal/CollectibleModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ const CollectibleModal = () => {

const onSend = useCallback(async () => {
dispatch(newAssetTransaction({ contractName, ...collectible }));
navigateToSendPage(InitSendLocation.CollectibleModal, collectible);
navigateToSendPage({
location: InitSendLocation.CollectibleModal,
asset: collectible,
});
}, [contractName, collectible, dispatch, navigateToSendPage]);

const isTradable = useCallback(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
import React, { useCallback } from 'react';
import {
View,
TouchableOpacity,
Pressable,
Keyboard,
TextInput,
Platform,
} from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { useStyles } from '../../../../../component-library/hooks';
import {
Box,
BoxFlexDirection,
BoxAlignItems,
} from '@metamask/design-system-react-native';
import { useTailwind } from '@metamask/design-system-twrnc-preset';
import Icon, {
IconName,
IconSize,
IconColor,
} from '../../../../../component-library/components/Icons/Icon';
import Text, {
TextVariant,
TextColor,
} from '../../../../../component-library/components/Texts/Text';
import React from 'react';
import { strings } from '../../../../../../locales/i18n';
import { useTheme } from '../../../../../util/theme';
import ListHeaderWithSearch from '../../../shared/ListHeaderWithSearch';
import type { PerpsMarketListHeaderProps } from './PerpsMarketListHeader.types';
import styleSheet from './PerpsMarketListHeader.styles';

/**
* PerpsMarketListHeader Component
Expand Down Expand Up @@ -59,109 +33,13 @@ import styleSheet from './PerpsMarketListHeader.styles';
* />
* ```
*/
const PerpsMarketListHeader: React.FC<PerpsMarketListHeaderProps> = ({
title,
isSearchVisible = false,
searchQuery = '',
onSearchQueryChange,
onSearchClear: _onSearchClear, // Not used - clear icon removed
onBack,
onSearchToggle,
testID,
}) => {
const { styles } = useStyles(styleSheet, {});
const tw = useTailwind();
const { colors } = useTheme();
const navigation = useNavigation();

// Default back handler
const defaultHandleBack = useCallback(() => {
if (navigation.canGoBack()) {
navigation.goBack();
}
}, [navigation]);

// Use custom handler if provided, otherwise use default
const handleBack = onBack || defaultHandleBack;

return (
<Pressable
style={styles.header}
onPress={() => Keyboard.dismiss()}
testID={testID}
>
{isSearchVisible ? (
<View style={styles.headerContainerWrapper}>
{/* Search Bar - Replaces back button and title */}
<Box
flexDirection={BoxFlexDirection.Row}
alignItems={BoxAlignItems.Center}
style={styles.searchBarContainer}
twClassName={`flex-1 bg-muted rounded-lg ${Platform.OS === 'ios' ? 'py-3' : 'py-1'} px-3 mr-2`}
>
<Icon
name={IconName.Search}
size={IconSize.Sm}
color={IconColor.Alternative}
style={tw.style('mr-2')}
/>
<TextInput
value={searchQuery}
onChangeText={onSearchQueryChange}
placeholder={strings('perps.search_by_token_symbol')}
placeholderTextColor={colors.text.muted}
autoFocus
style={tw.style('flex-1 text-base text-default')}
testID={testID ? `${testID}-search-bar` : undefined}
/>
</Box>
{/* Cancel Button */}
<TouchableOpacity
style={styles.searchButton}
onPress={onSearchToggle}
testID={testID ? `${testID}-search-close` : undefined}
>
<Text variant={TextVariant.BodyMD} color={TextColor.Default}>
{strings('perps.cancel')}
</Text>
</TouchableOpacity>
</View>
) : (
<View style={styles.headerContainerWrapper}>
{/* Back Button */}
<TouchableOpacity
style={styles.backButton}
onPress={handleBack}
testID={testID ? `${testID}-back-button` : undefined}
>
<Icon name={IconName.ArrowLeft} size={IconSize.Md} />
</TouchableOpacity>

{/* Title */}
<View style={styles.headerTitleContainer}>
<Text
variant={TextVariant.HeadingLG}
color={TextColor.Default}
style={styles.headerTitle}
>
{title || strings('perps.title')}
</Text>
</View>

{/* Search Toggle Button */}
<View style={styles.titleButtonsRightContainer}>
<TouchableOpacity
style={styles.searchButton}
onPress={onSearchToggle}
testID={testID ? `${testID}-search-toggle` : undefined}
>
<Icon name={IconName.Search} size={IconSize.Lg} />
</TouchableOpacity>
</View>
</View>
)}
</Pressable>
);
};
const PerpsMarketListHeader: React.FC<PerpsMarketListHeaderProps> = (props) => (
<ListHeaderWithSearch
{...props}
defaultTitle={strings('perps.title')}
searchPlaceholder={strings('perps.search_by_token_symbol')}
cancelText={strings('perps.cancel')}
/>
);

export default PerpsMarketListHeader;
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ exports[`BuildQuote View Balance display displays balance from useBalance for no
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -1772,6 +1773,7 @@ exports[`BuildQuote View Balance display displays balance from useBalance for no
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -2786,6 +2788,7 @@ exports[`BuildQuote View Balance display displays balance from useBalance for no
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -5636,6 +5639,7 @@ exports[`BuildQuote View Crypto Currency Data renders the loading page when cryp
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -6518,6 +6522,7 @@ exports[`BuildQuote View Crypto Currency Data renders the loading page when cryp
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -7532,6 +7537,7 @@ exports[`BuildQuote View Crypto Currency Data renders the loading page when cryp
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -8959,6 +8965,7 @@ exports[`BuildQuote View Fiat Currency Data renders the loading page when fiats
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -9750,6 +9757,7 @@ exports[`BuildQuote View Fiat Currency Data renders the loading page when fiats
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -10764,6 +10772,7 @@ exports[`BuildQuote View Fiat Currency Data renders the loading page when fiats
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -12191,6 +12200,7 @@ exports[`BuildQuote View Payment Method Data renders no icons if there are no pa
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -13326,6 +13336,7 @@ exports[`BuildQuote View Payment Method Data renders no icons if there are no pa
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -14340,6 +14351,7 @@ exports[`BuildQuote View Payment Method Data renders no icons if there are no pa
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -15007,6 +15019,7 @@ exports[`BuildQuote View Payment Method Data renders the loading page when payme
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -16064,6 +16077,7 @@ exports[`BuildQuote View Payment Method Data renders the loading page when payme
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -17078,6 +17092,7 @@ exports[`BuildQuote View Payment Method Data renders the loading page when payme
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -18505,6 +18520,7 @@ exports[`BuildQuote View Regions data renders the loading page when regions are
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -19260,6 +19276,7 @@ exports[`BuildQuote View Regions data renders the loading page when regions are
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -20274,6 +20291,7 @@ exports[`BuildQuote View Regions data renders the loading page when regions are
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -20941,6 +20959,7 @@ exports[`BuildQuote View renders correctly 1`] = `
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -22119,6 +22138,7 @@ exports[`BuildQuote View renders correctly 1`] = `
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -23133,6 +23153,7 @@ exports[`BuildQuote View renders correctly 1`] = `
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -23703,6 +23724,7 @@ exports[`BuildQuote View renders correctly 2`] = `
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -24797,6 +24819,7 @@ exports[`BuildQuote View renders correctly 2`] = `
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down Expand Up @@ -25875,6 +25898,7 @@ exports[`BuildQuote View renders correctly 2`] = `
[
{
"padding": 15,
"paddingHorizontal": 16,
},
undefined,
undefined,
Expand Down
Loading
Loading