Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: token network selector (WIP) #12224

Closed
wants to merge 144 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
0248c74
feat: Add sortAssets utility function
gambinish Sep 27, 2024
6a2e8c7
chore: Breakup monolithic Tokens/index.tsx into smaller components
gambinish Sep 27, 2024
7a78717
fix: Correctly handle null check for buyable footer button
gambinish Sep 27, 2024
57295ee
fix: Tweak boolean logic for rendering footer components
gambinish Sep 27, 2024
d00354f
chore: Update snapshot
gambinish Sep 27, 2024
be87f81
chore: Type out tokens as TokenI[]
gambinish Sep 27, 2024
68c7b2e
chore: Remove unecessary comments around import statements in Networt…
gambinish Sep 27, 2024
a02e139
Merge branch 'main' into chore/componetize-tokens-screen
gambinish Sep 27, 2024
de5bbed
Merge branch 'main' into chore/componetize-tokens-screen
gambinish Sep 27, 2024
0fd9ad5
Merge branch 'main' into chore/componetize-tokens-screen
gambinish Sep 27, 2024
032618c
chore: Add unit tests to utility file, provide exports from index file
gambinish Sep 30, 2024
a58f1ba
chore: Rename handleBalance to me more descriptive of what its logic …
gambinish Sep 30, 2024
1dd31e3
chore: rename Networth to PortfolioBalance for clarity
gambinish Sep 30, 2024
16ded6a
chore: Cleanup styles extra whitespace
gambinish Sep 30, 2024
52d3d85
Merge branch 'main' into chore/componetize-tokens-screen
gambinish Sep 30, 2024
dd3ffdf
fix: Update snapshot tests
gambinish Sep 30, 2024
da640bc
Merge branch 'chore/componetize-tokens-screen' of github.com:MetaMask…
gambinish Sep 30, 2024
ebcbcf6
fix: Remove unused component
gambinish Sep 30, 2024
31fad19
Merge branch 'main' into chore/componetize-tokens-screen
gambinish Sep 30, 2024
4a8d927
chore: Move PotfolioBalance above TabView
gambinish Oct 1, 2024
a7b4c17
fix: Wrap PortfolioBalance and ScrollableView in fragment for token r…
gambinish Oct 1, 2024
658fcf6
fix: Padding tweak below tab bar for consistency of token list
gambinish Oct 1, 2024
18035d4
fix: Reorganize test suite for PortfolioBalance
gambinish Oct 1, 2024
c570c2c
fix: Revert changes to wallet test
gambinish Oct 1, 2024
a97128b
fix: Update fiatBalance text style to DisplayMD
gambinish Oct 1, 2024
8036a0a
chore: Patch PreferencesController with tokenSortConfig
gambinish Oct 1, 2024
1f0ac51
chore: Patch preferences controller with type
gambinish Oct 1, 2024
34d987c
feat: Build token sorting UI, patch PreferencesController
gambinish Oct 4, 2024
d57558b
chore: Merge main, address merge conflicts
gambinish Oct 7, 2024
c5c954c
fix: ListHeaderComponent not needed in FlatList anymore
gambinish Oct 7, 2024
4f635e8
fix: Update snapshots and lint
gambinish Oct 7, 2024
469270a
chore: Merge develop, address conflicts
gambinish Oct 8, 2024
82eb1a2
chore: Remove destructive index
gambinish Oct 9, 2024
f18b820
Merge branch 'main' into feat/mmassets_357-sort-import-tokens-mobile-…
gambinish Oct 10, 2024
d3a79fc
chore: Merge main, address conflicts
gambinish Oct 10, 2024
5fc979c
chore: Repatch preferences controller with tokenSortConfig
gambinish Oct 10, 2024
2890148
fix: Declning balance sort
gambinish Oct 10, 2024
25a7238
fix: Export raw value from deriveBalanceFromAssetMarketDetails
gambinish Oct 10, 2024
6637303
fix: deriveBalanceFromAssetMarketDetails.test.ts
gambinish Oct 10, 2024
0415b73
fix: Update unit tests and snapshots
gambinish Oct 10, 2024
ff32cc4
fix: Lint unused imports from Tokens/index.tsx
gambinish Oct 10, 2024
f4f2519
chore: Update testIds and locale strings
gambinish Oct 11, 2024
bd61eff
fix: Update WalletView import selector
gambinish Oct 11, 2024
f28b6fe
fix: Update snapshots
gambinish Oct 11, 2024
7c9d5cc
chore: Cleanup
gambinish Oct 11, 2024
e747848
fix: Add navigation type
gambinish Oct 11, 2024
71ce22f
fix: fix snapshot
salimtb Oct 11, 2024
6aa6f3f
Merge branch 'main' into feat/mmassets_357-sort-import-tokens-mobile-…
salimtb Oct 15, 2024
fe21f40
chore: Update snapshots
gambinish Oct 15, 2024
6f52163
Merge branch 'feat/mmassets_357-sort-import-tokens-mobile--reorg-port…
gambinish Oct 15, 2024
579f012
fix: Update placeholders in switch statement
gambinish Oct 15, 2024
68338a3
Merge branch 'feat/mmassets_357-sort-import-tokens-mobile--token-sort…
gambinish Oct 15, 2024
ff95c72
chore: Add additional e2e test for import token footer link
gambinish Oct 15, 2024
1d929ce
chore: Update snapshots
gambinish Oct 15, 2024
9cf6337
chore: Patch PreferencesController with tokenNetworkFilter
gambinish Oct 16, 2024
fcf0d64
fix: Update to correct type in PreferenceController patch
gambinish Oct 16, 2024
e3196a3
fix: Correct method name in patched PreferenceController
gambinish Oct 16, 2024
aa5b6da
chore: Integrate Filter dropdown with PreferencesController
gambinish Oct 16, 2024
a926d64
fix: Break out of switch statement rather than returning arbitrary st…
gambinish Oct 16, 2024
d3c5d81
chore: Init BottomSheet refactor
gambinish Oct 16, 2024
e925da3
fix: Remove arbitrary 8 second delays from import-tokens.spec
gambinish Oct 16, 2024
0c9ca35
fix: Use ButtonBase component to customize button text color more dir…
gambinish Oct 16, 2024
63bb1a2
fix: Update snapshot
gambinish Oct 16, 2024
a5d8b71
fix: Mock initial state that PortfolioBalance component needs
gambinish Oct 16, 2024
0b617f2
fix: Mock tabs in snapshot
gambinish Oct 16, 2024
96436be
fix: Consider Error boundary during Wallet rendering process
gambinish Oct 16, 2024
1365f4d
fix: Update localized string
gambinish Oct 16, 2024
bd9ad0d
Merge branch 'feat/mmassets_357-sort-import-tokens-mobile--reorg-port…
gambinish Oct 16, 2024
da5862d
Merge branch 'main' into feat/mmassets_357-sort-import-tokens-mobile-…
gambinish Oct 17, 2024
c0a28bc
Merge branch 'feat/mmassets_357-sort-import-tokens-mobile--reorg-port…
gambinish Oct 17, 2024
2934811
Merge branch 'main' into feat/mmassets_357-sort-import-tokens-mobile-…
gambinish Oct 17, 2024
8cb67f7
Merge branch 'feat/mmassets_357-sort-import-tokens-mobile--reorg-port…
gambinish Oct 17, 2024
990067f
Merge branch 'main' into feat/mmassets_357-sort-import-tokens-mobile-…
gambinish Oct 17, 2024
1f5ad7f
chore: Add TokenSortBottomSheet to RootModalFlow in Routes
gambinish Oct 17, 2024
e5b060e
fix: Resolve upstream conflicts
gambinish Oct 17, 2024
c057c24
fix: Lint:tsc
gambinish Oct 17, 2024
4e9f8d9
fix: Lint
gambinish Oct 17, 2024
319706d
chore: Init unit tests for new UI
gambinish Oct 18, 2024
6bfa6ab
chore: Merge main
gambinish Oct 23, 2024
60bbfe3
chore: Show selected network in filter
gambinish Oct 23, 2024
bd40392
fix: Update unit tests and snapshots
gambinish Oct 23, 2024
dd3de6f
chore: Merge main, address conflicts
gambinish Oct 23, 2024
e8b22c4
fix: Add test for refresh control on tokens screen
gambinish Oct 23, 2024
d5a41ba
chore: Update testID selectors for token list
gambinish Oct 23, 2024
ce983b8
chore: Add tokenSort BottomSheet trigger test
gambinish Oct 23, 2024
931b122
chore: Lint
gambinish Oct 23, 2024
3fd170f
fix: Update snapshots
gambinish Oct 23, 2024
0d00f62
chore: TokenSortBottomSheet unit tests
gambinish Oct 23, 2024
a6f12d0
Merge branch 'main' into feat/mmassets-431_network-filter-ui
gambinish Oct 23, 2024
784c39f
chore: Cleanup
gambinish Oct 23, 2024
6a4a64e
chore: Cleanup, and queryByTestID for test stability
gambinish Oct 23, 2024
1dfd1bf
chore: More cleanup
gambinish Oct 23, 2024
fe1e236
chore: Merge main, address conflicts
gambinish Oct 23, 2024
0fe13d9
fix: Lint
gambinish Oct 24, 2024
4c6b6c2
Merge branch 'feat/mmassets_357-sort-import-tokens-mobile--token-sort…
gambinish Oct 24, 2024
84ca594
fix: Lint after conflicts
gambinish Oct 24, 2024
997fc3d
fix: Missing testIDs after merge for unit tests
gambinish Oct 24, 2024
43e9c85
chore: Merge main, address conflicts
gambinish Oct 29, 2024
18c4e43
refactor: Filter ActionSheet should be BottomSheet
gambinish Oct 29, 2024
d34b986
chore: Tweak styles to fix merge conflict
gambinish Oct 29, 2024
621bd6f
fix: Update unit tests with correct import path
gambinish Oct 29, 2024
4c5dab9
chore: Add unit tests for TokenFilterBottomSheet
gambinish Oct 29, 2024
d3b4356
chore: Add locale strings
gambinish Oct 29, 2024
e656fe6
chore: Add MM_TOKEN_NETWORK_FILTER_ENABLED feature flag
gambinish Oct 29, 2024
04c2613
fix: Add missing locale string
gambinish Oct 29, 2024
b146421
chore: Update snapshots
gambinish Oct 29, 2024
7fe0909
fix: Cleanup localisation strings and code comments
gambinish Oct 29, 2024
16a6bac
fix: Cleanup localisation strings, remove code comments, update featu…
gambinish Oct 29, 2024
27c3050
chore: Revert changes to component-library that are no longer needed
gambinish Oct 29, 2024
a79f3a6
fix: Lint whitespace diff
gambinish Oct 29, 2024
1c1b6cb
fix: Another whitespace diff fix
gambinish Oct 29, 2024
a8fc838
Merge branch 'main' into feat/mmassets-431_network-filter-ui
gambinish Oct 31, 2024
66c27e6
chore: Merge main
gambinish Oct 31, 2024
77442e4
fix: Remove outdated patch to preferenceController
gambinish Oct 31, 2024
195f656
chore: Repatch package with tokenNetworkFilter
gambinish Oct 31, 2024
cfcc55f
fix: Lint
gambinish Nov 1, 2024
ad121ee
chore: Merge main, address conflicts
gambinish Nov 1, 2024
e3fdea1
Merge branch 'main' into feat/mmassets-431_network-filter-ui
gambinish Nov 1, 2024
9ebaa20
Merge branch 'main' into feat/mmassets-431_network-filter-ui
gambinish Nov 1, 2024
11af1e7
chore: Merge main
gambinish Nov 4, 2024
dc5d76c
Merge branch 'main' into feat/mmassets-431_network-filter-ui
gambinish Nov 4, 2024
9d3260e
Merge branch 'main' into feat/mmassets-431_network-filter-ui
gambinish Nov 5, 2024
b2781a5
refactor: Update AssetListControls buttons to icons per design revisions
gambinish Nov 5, 2024
f3b9a14
fix: Update button text wrapping with snapshots
gambinish Nov 5, 2024
4a52719
Merge branch 'feat/mmassets-431_network-filter-ui' of github.com:Meta…
gambinish Nov 5, 2024
e392f21
Merge branch 'main' into feat/mmassets-431_network-filter-ui
gambinish Nov 5, 2024
68a76d6
fix: Lint
gambinish Nov 5, 2024
166ac02
Merge branch 'feat/mmassets-431_network-filter-ui' of github.com:Meta…
gambinish Nov 5, 2024
fcafb86
Merge branch 'main' into feat/mmassets-431_network-filter-ui
gambinish Nov 5, 2024
de35586
Merge branch 'main' into feat/mmassets-431_network-filter-ui
gambinish Nov 6, 2024
edc8c5c
chore: Replace unrelated build flag
gambinish Nov 6, 2024
5aef7ba
feat: filtering tokens by all networks or one network
vinnyhoward Nov 7, 2024
915549e
Merge branch 'main' into feat/mmassets-431_network-filter-ui
gambinish Nov 7, 2024
f83b81a
Merge branch 'feat/mmassets-431_network-filter-ui' of github.com:Meta…
vinnyhoward Nov 7, 2024
a06c896
fix: renaming test file to match component file
vinnyhoward Nov 7, 2024
82f69bd
fix: revert change - wrong branch
vinnyhoward Nov 7, 2024
ab20b3e
fix: Remove unused font style
gambinish Nov 8, 2024
fd28086
fix: Use true for feature flag
gambinish Nov 8, 2024
94e9bfe
Merge branch 'feat/mmassets-431_network-filter-ui' of github.com:Meta…
vinnyhoward Nov 8, 2024
db79b71
fix: Unblock podfile during CI
gambinish Nov 8, 2024
1297288
Merge branch 'feat/mmassets-431_network-filter-ui' of github.com:Meta…
vinnyhoward Nov 8, 2024
7ddba48
feat: partial update to token list related logic
vinnyhoward Nov 8, 2024
ae232b1
Merge branch 'feat-431-network-filter-selector' of github.com:MetaMas…
vinnyhoward Nov 8, 2024
2a71002
test: update comments
vinnyhoward Nov 9, 2024
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
7 changes: 6 additions & 1 deletion app/components/Nav/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ import Toast, {
ToastContext,
} from '../../../component-library/components/Toast';
import AccountSelector from '../../../components/Views/AccountSelector';
import TokenSortBottomSheet from '../../../components/UI/Tokens/TokensBottomSheet/TokenSortBottomSheet.tsx';
import { TokenSortBottomSheet } from '../../../components/UI/Tokens/TokensBottomSheet/TokenSortBottomSheet.tsx';
import { TokenFilterBottomSheet } from '../../../components/UI/Tokens/TokensBottomSheet/TokenFilterBottomSheet.tsx';
import AccountConnect from '../../../components/Views/AccountConnect';
import AccountPermissions from '../../../components/Views/AccountPermissions';
import { AccountPermissionsScreens } from '../../../components/Views/AccountPermissions/AccountPermissions.types';
Expand Down Expand Up @@ -432,6 +433,10 @@ const RootModalFlow = () => (
name={Routes.SHEET.TOKEN_SORT}
component={TokenSortBottomSheet}
/>
<Stack.Screen
name={Routes.SHEET.TOKEN_FILTER}
component={TokenFilterBottomSheet}
/>
<Stack.Screen
name={Routes.SHEET.BASIC_FUNCTIONALITY}
component={BasicFunctionalityModal}
Expand Down
33 changes: 22 additions & 11 deletions app/components/UI/Tokens/TokenList/TokenListItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,18 @@
import NetworkMainAssetLogo from '../../../NetworkMainAssetLogo';
import images from 'images/image-icons';
import { TokenI } from '../../types';
import { strings } from '../../../../../../locales/i18n';
import I18n, { strings } from '../../../../../../locales/i18n';
import { ScamWarningIcon } from '../ScamWarningIcon';
import { ScamWarningModal } from '../ScamWarningModal';
import { StakeButton } from '../../../Stake/components/StakeButton';
import { CustomNetworkImgMapping } from '../../../../../util/networks/customNetworks';
import useStakingChain from '../../../Stake/hooks/useStakingChain';

export function getImageForChainId(chainId: string) {
// TODO: Fetch by image url by chain id
console.log('chainId:', chainId);
}

interface TokenListItemProps {
asset: TokenI;
showScamWarningModal: boolean;
Expand Down Expand Up @@ -89,14 +94,20 @@

const itemAddress = safeToChecksumAddress(asset.address);

const { balanceFiat, balanceValueFormatted } =
deriveBalanceFromAssetMarketDetails(
asset,
tokenExchangeRates,
tokenBalances,
conversionRate,
currentCurrency,
);
const { _, balanceValueFormatted } = deriveBalanceFromAssetMarketDetails(

Check failure on line 97 in app/components/UI/Tokens/TokenList/TokenListItem/index.tsx

View workflow job for this annotation

GitHub Actions / scripts (lint:tsc)

Property '_' does not exist on type '{ balanceFiat: string; balanceValueFormatted: string; balanceFiatCalculation?: undefined; } | { balanceFiat: string; balanceValueFormatted: string; balanceFiatCalculation: number; }'.
asset,
tokenExchangeRates,
tokenBalances,
conversionRate,
currentCurrency,
);

// format pricing here
const { tokenFiatAmount } = asset;

Check failure on line 106 in app/components/UI/Tokens/TokenList/TokenListItem/index.tsx

View workflow job for this annotation

GitHub Actions / scripts (lint:tsc)

Property 'tokenFiatAmount' does not exist on type 'TokenI'.
const balanceFiat = new Intl.NumberFormat(I18n.locale, {
currency: currentCurrency.toUpperCase(),
style: 'currency',
}).format(tokenFiatAmount);

const pricePercentChange1d = itemAddress
? tokenExchangeRates?.[itemAddress as `0x${string}`]?.pricePercentChange1d
Expand Down Expand Up @@ -155,7 +166,7 @@
const isLineaMainnet = isLineaMainnetByChainId(chainId);

const { isStakingSupportedChain } = useStakingChain();

console.log('images', images);
const NetworkBadgeSource = () => {
if (isTestNet(chainId)) return getTestNetImageByChainId(chainId);

Expand All @@ -175,7 +186,7 @@
...token,
});
};

console.log('network badge source:', getImageForChainId(chainId));
return (
<AssetElement
key={itemAddress || '0x'}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import React from 'react';
import { render, fireEvent, waitFor } from '@testing-library/react-native';
import { TokenFilterBottomSheet } from './TokenFilterBottomSheet';
import { useSelector } from 'react-redux';
import Engine from '../../../../core/Engine';
import { selectChainId } from '../../../../selectors/networkController';
import { selectTokenNetworkFilter } from '../../../../selectors/preferencesController';

jest.mock('react-redux', () => ({
useSelector: jest.fn(),
}));

jest.mock('../../../../util/theme', () => ({
useTheme: jest.fn(() => ({ colors: {} })),
}));

jest.mock('../../../../core/Engine', () => ({
context: {
PreferencesController: {
setTokenNetworkFilter: jest.fn(),
},
},
}));

jest.mock('@react-navigation/native', () => {
const reactNavigationModule = jest.requireActual('@react-navigation/native');
return {
...reactNavigationModule,
useNavigation: () => ({
navigate: jest.fn(),
goBack: jest.fn(),
}),
};
});

jest.mock('react-native-safe-area-context', () => {
// copied from BottomSheetDialog.test.tsx
const inset = { top: 1, right: 2, bottom: 3, left: 4 };
const frame = { width: 5, height: 6, x: 7, y: 8 };
return {
SafeAreaProvider: jest.fn().mockImplementation(({ children }) => children),
SafeAreaConsumer: jest
.fn()
.mockImplementation(({ children }) => children(inset)),
useSafeAreaInsets: jest.fn().mockImplementation(() => inset),
useSafeAreaFrame: jest.fn().mockImplementation(() => frame),
};
});

describe('TokenFilterBottomSheet', () => {
beforeEach(() => {
(useSelector as jest.Mock).mockImplementation((selector) => {
if (selector === selectChainId) {
return '0x1'; // default chain ID
} else if (selector === selectTokenNetworkFilter) {
return {}; // default to show all networks
}
return null;
});
});

afterEach(() => {
jest.clearAllMocks();
});

it('renders correctly with the default option (All Networks) selected', () => {
const { queryByText } = render(<TokenFilterBottomSheet />);

expect(queryByText('All Networks')).toBeTruthy();
expect(queryByText('Current Network')).toBeTruthy();
});

it('sets filter to All Networks and closes bottom sheet when first option is pressed', async () => {
const { queryByText } = render(<TokenFilterBottomSheet />);

fireEvent.press(queryByText('All Networks'));

await waitFor(() => {
expect(
Engine.context.PreferencesController.setTokenNetworkFilter,
).toHaveBeenCalledWith({});
});
});

it('sets filter to Current Network and closes bottom sheet when second option is pressed', async () => {
const { queryByText } = render(<TokenFilterBottomSheet />);

fireEvent.press(queryByText('Current Network'));

await waitFor(() => {
expect(
Engine.context.PreferencesController.setTokenNetworkFilter,
).toHaveBeenCalledWith({
'0x1': true,
});
});
});

it('displays the correct selection based on tokenNetworkFilter', () => {
(useSelector as jest.Mock).mockImplementation((selector) => {
if (selector === selectChainId) {
return '0x1';
} else if (selector === selectTokenNetworkFilter) {
return { '0x1': true }; // filter by current network
}
return null;
});

const { queryByText } = render(<TokenFilterBottomSheet />);

expect(queryByText('Current Network')).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import React, { useRef } from 'react';
import { useSelector } from 'react-redux';
import {
selectChainId,
selectNetworkConfigurations,
} from '../../../../selectors/networkController';
import { selectTokenNetworkFilter } from '../../../../selectors/preferencesController';
import BottomSheet, {
BottomSheetRef,
} from '../../../../component-library/components/BottomSheets/BottomSheet';
import { useTheme } from '../../../../util/theme';
import createStyles from '../styles';
import Engine from '../../../../core/Engine';
import { View } from 'react-native';
import Text, {
TextVariant,
} from '../../../../component-library/components/Texts/Text';
import ListItemSelect from '../../../../component-library/components/List/ListItemSelect';
import { VerticalAlignment } from '../../../../component-library/components/List/ListItem';
import { strings } from '../../../../../locales/i18n';

enum FilterOption {
AllNetworks,
CurrentNetwork,
}

const TokenFilterBottomSheet = () => {
const sheetRef = useRef<BottomSheetRef>(null);
const { colors } = useTheme();
const styles = createStyles(colors);

const chainId = useSelector(selectChainId);
const allNetworks = useSelector(selectNetworkConfigurations);
const tokenNetworkFilter = useSelector(selectTokenNetworkFilter);

const allOpts: Record<string, boolean> = {};
Object.keys(allNetworks).forEach((networkChainId) => {
allOpts[networkChainId] = true;
});

const onFilterControlsBottomSheetPress = (option: FilterOption) => {
const { PreferencesController } = Engine.context;

switch (option) {
case FilterOption.AllNetworks:
PreferencesController.setTokenNetworkFilter(allOpts);
sheetRef.current?.onCloseBottomSheet();
break;
case FilterOption.CurrentNetwork:
PreferencesController.setTokenNetworkFilter({
[chainId]: true,
});
sheetRef.current?.onCloseBottomSheet();
break;
default:
break;
}
};

const isCurrentNetwork = Boolean(
tokenNetworkFilter[chainId] && Object.keys(tokenNetworkFilter).length === 1,
);
const isAllNetworks =
Object.keys(tokenNetworkFilter).length === Object.keys(allNetworks).length;

return (
<BottomSheet shouldNavigateBack ref={sheetRef}>
<View style={styles.bottomSheetWrapper}>
<Text variant={TextVariant.HeadingMD} style={styles.bottomSheetTitle}>
{strings('wallet.filter_by')}
</Text>
<ListItemSelect
onPress={() =>
onFilterControlsBottomSheetPress(FilterOption.AllNetworks)
}
isSelected={isAllNetworks}
gap={8}
verticalAlignment={VerticalAlignment.Center}
>
<Text style={styles.bottomSheetText}>
{strings('wallet.all_networks')}
</Text>
</ListItemSelect>
<ListItemSelect
onPress={() =>
onFilterControlsBottomSheetPress(FilterOption.CurrentNetwork)
}
isSelected={isCurrentNetwork}
gap={8}
verticalAlignment={VerticalAlignment.Center}
>
<Text style={styles.bottomSheetText}>
{strings('wallet.current_network')}
</Text>
</ListItemSelect>
</View>
</BottomSheet>
);
};

export { TokenFilterBottomSheet };
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, fireEvent, waitFor } from '@testing-library/react-native';
import TokenSortBottomSheet from './TokenSortBottomSheet';
import { TokenSortBottomSheet } from './TokenSortBottomSheet';
import { useSelector } from 'react-redux';
import Engine from '../../../../core/Engine';
import { selectTokenSortConfig } from '../../../../selectors/preferencesController';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ const TokenSortBottomSheet = () => {
);
};

export default TokenSortBottomSheet;
export { TokenSortBottomSheet };
9 changes: 8 additions & 1 deletion app/components/UI/Tokens/TokensBottomSheet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ export const createTokensBottomSheetNavDetails = createNavigationDetails(
Routes.MODAL.ROOT_MODAL_FLOW,
Routes.SHEET.TOKEN_SORT,
);
export { default } from './TokenSortBottomSheet';

export const createTokenBottomSheetFilterNavDetails = createNavigationDetails(
Routes.MODAL.ROOT_MODAL_FLOW,
Routes.SHEET.TOKEN_FILTER,
);

export { TokenSortBottomSheet } from './TokenSortBottomSheet';
export { TokenFilterBottomSheet } from './TokenFilterBottomSheet';
Loading
Loading