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(suite-native): use filled icons for focused items in tab bar #15965

Merged
merged 1 commit into from
Dec 17, 2024
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
3 changes: 3 additions & 0 deletions suite-common/icons/generateIconFont.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const usedIcons = [
'database',
'detective',
'discover',
'discoverFilled',
'eye',
'eyeSlash',
'facebookLogo',
Expand All @@ -60,9 +61,11 @@ const usedIcons = [
'flag',
'flagCheckered',
'gear',
'gearFilled',
'githubLogo',
'handPalm',
'house',
'houseFilled',
'image',
'info',
'lifebuoy',
Expand Down
102 changes: 53 additions & 49 deletions suite-common/icons/iconFontsMobile/TrezorSuiteIcons.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,53 +44,57 @@
"lifebuoy": 61739,
"info": 61740,
"image": 61741,
"house": 61742,
"handPalm": 61743,
"githubLogo": 61744,
"gear": 61745,
"flagCheckered": 61746,
"flag": 61747,
"fingerprintSimple": 61748,
"fingerprint": 61749,
"filePdf": 61750,
"facebookLogo": 61751,
"eyeSlash": 61752,
"eye": 61753,
"discover": 61754,
"detective": 61755,
"database": 61756,
"cpu": 61757,
"copy": 61758,
"coins": 61759,
"coinVerticalCheck": 61760,
"clockClockwise": 61761,
"circleDashed": 61762,
"checks": 61763,
"checkCircleFilled": 61764,
"checkCircle": 61765,
"check": 61766,
"chatCircle": 61767,
"change": 61768,
"caretUpFilled": 61769,
"caretUpDown": 61770,
"caretUp": 61771,
"caretRight": 61772,
"caretLeft": 61773,
"caretDownFilled": 61774,
"caretDown": 61775,
"caretCircleRight": 61776,
"calendar": 61777,
"bugBeetle": 61778,
"bookmarkSimple": 61779,
"backspace": 61780,
"arrowsCounterClockwise": 61781,
"arrowUpRight": 61782,
"arrowUp": 61783,
"arrowURightDown": 61784,
"arrowSquareOut": 61785,
"arrowRight": 61786,
"arrowLineUpRight": 61787,
"arrowLineUp": 61788,
"arrowLineDown": 61789,
"arrowDown": 61790
"houseFilled": 61742,
"house": 61743,
"handPalm": 61744,
"githubLogo": 61745,
"gearFilled": 61746,
"gear": 61747,
"flagCheckered": 61748,
"flag": 61749,
"fingerprintSimple": 61750,
"fingerprint": 61751,
"filePdf": 61752,
"facebookLogo": 61753,
"eyeSlash": 61754,
"eye": 61755,
"discoverFilled": 61756,
"discover": 61757,
"detective": 61758,
"database": 61759,
"cpu": 61760,
"copy": 61761,
"coins": 61762,
"coinVerticalCheck": 61763,
"clockClockwise": 61764,
"circleDashed": 61765,
"checks": 61766,
"checkCircleFilled": 61767,
"checkCircle": 61768,
"check": 61769,
"chatCircle": 61770,
"change": 61771,
"caretUpFilled": 61772,
"caretUpDown": 61773,
"caretUp": 61774,
"caretRight": 61775,
"caretLeft": 61776,
"caretDownFilled": 61777,
"caretDown": 61778,
"caretCircleRight": 61779,
"calendar": 61780,
"bugBeetle": 61781,
"bookmarkSimple": 61782,
"backspace": 61783,
"arrowsCounterClockwise": 61784,
"arrowUpRight": 61785,
"arrowUp": 61786,
"arrowURightDown": 61787,
"arrowSquareOut": 61788,
"arrowRight": 61789,
"arrowLineUpRight": 61790,
"arrowLineUp": 61791,
"arrowLineDownFilled": 61792,
"arrowLineDown": 61793,
"arrowDown": 61794
}
Binary file modified suite-common/icons/iconFontsMobile/TrezorSuiteIcons.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion suite-native/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default ({ config }: ConfigContext): ExpoConfig => {
slug: appSlugs[buildType],
owner: appOwners[buildType],
version: suiteNativeVersion,
runtimeVersion: '20',
runtimeVersion: '21',
...(buildType === 'production'
? {}
: {
Expand Down
3 changes: 3 additions & 0 deletions suite-native/app/src/navigation/enhanceTabOption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AppTabsParamList } from '@suite-native/navigation';
type TabOption<ParamList extends AppTabsParamList, RouteName extends keyof ParamList> = {
routeName: RouteName;
iconName: IconName;
focusedIconName: IconName;
label: string;
params?: ParamList[RouteName];
};
Expand All @@ -14,12 +15,14 @@ export const enhanceTabOption = <
>({
routeName,
iconName,
focusedIconName,
label,
params,
}: TabOption<ParamList, RouteName>) => ({
[routeName]: {
routeName,
iconName,
focusedIconName,
label,
params,
},
Expand Down
4 changes: 4 additions & 0 deletions suite-native/app/src/navigation/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import { enhanceTabOption } from './enhanceTabOption';
const homeStack = enhanceTabOption({
routeName: AppTabsRoutes.HomeStack,
iconName: 'house',
focusedIconName: 'houseFilled',
label: 'Home',
});

const accountsStack = enhanceTabOption({
routeName: AppTabsRoutes.AccountsStack,
iconName: 'discover',
focusedIconName: 'discoverFilled',
label: 'My assets',
params: {
screen: AccountsStackRoutes.Accounts,
Expand All @@ -21,11 +23,13 @@ const receiveStack = enhanceTabOption({
routeName: AppTabsRoutes.ReceiveStack,
label: 'Receive',
iconName: 'arrowLineDown',
focusedIconName: 'arrowLineDown',
});

const settingsStack = enhanceTabOption({
routeName: AppTabsRoutes.SettingsStack,
iconName: 'gear',
focusedIconName: 'gearFilled',
label: 'Settings',
});

Expand Down
4 changes: 3 additions & 1 deletion suite-native/navigation/src/components/TabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export const TabBar = ({ state, navigation, tabItemOptions }: TabBarProps) => {
>
{state.routes.map((route, index) => {
const isFocused = state.index === index;
const { routeName, iconName, label, params } = tabItemOptions[route.name];
const { routeName, iconName, focusedIconName, label, params } =
tabItemOptions[route.name];

const handleTabBarItemPress = () => {
const event = navigation.emit({
Expand All @@ -62,6 +63,7 @@ export const TabBar = ({ state, navigation, tabItemOptions }: TabBarProps) => {
key={route.key}
isFocused={isFocused}
iconName={iconName}
focusedIconName={focusedIconName}
title={label}
onPress={handleTabBarItemPress}
testID={route.name}
Expand Down
12 changes: 10 additions & 2 deletions suite-native/navigation/src/components/TabBarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type TabBarItemProps = {
isFocused: boolean;
onPress: () => void;
iconName: IconName;
focusedIconName: IconName;
title?: string;
testID: string;
};
Expand All @@ -26,7 +27,14 @@ const tabBarItemContainerStyle = prepareNativeStyle(utils => ({

const TAB_BAR_ITEM_HORIZONTAL_HIT_SLOP = 15;

export const TabBarItem = ({ isFocused, onPress, iconName, title, testID }: TabBarItemProps) => {
export const TabBarItem = ({
isFocused,
onPress,
iconName,
focusedIconName,
title,
testID,
}: TabBarItemProps) => {
const { applyStyle } = useNativeStyles();

return (
Expand All @@ -49,7 +57,7 @@ export const TabBarItem = ({ isFocused, onPress, iconName, title, testID }: TabB
>
<View style={applyStyle(tabBarItemContainerStyle)}>
<Icon
name={iconName}
name={isFocused ? focusedIconName : iconName}
size="large"
color={isFocused ? 'iconPrimaryDefault' : 'iconDisabled'}
/>
Expand Down
1 change: 1 addition & 0 deletions suite-native/navigation/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export type TabsOptions = {
[routeName: string]: {
routeName: string;
iconName: IconName;
focusedIconName: IconName;
label: string;
params?: Record<string, unknown>;
};
Expand Down
Loading