Skip to content

Commit 36447eb

Browse files
committed
fix(BottomNavigation): Fixed icon styles
1 parent 9823326 commit 36447eb

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

src/components/BottomNavigation/__stories__/BottomNavigation.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ stories
2323
<BottomNavigation value={1} onChange={(_e, i) => console.log(`Clicked tab ${i}`)} >
2424
<BottomNavigationAction
2525
label="Item One"
26-
icon={{ type: 'image', size: 20, source: { uri: 'https://placeimg.com/100/100/any' } }}
26+
icon={{ type: 'icon', name: 'star' }}
2727
/>
2828
<BottomNavigationAction
2929
label="Item Two"
30-
icon={{ type: 'image', size: 20, source: { uri: 'https://placeimg.com/100/100/any' } }}
30+
icon={{ type: 'icon', name: 'favorite' }}
3131
/>
3232
<BottomNavigationAction
3333
label="Item Three"
34-
icon={{ type: 'image', size: 20, source: { uri: 'https://placeimg.com/100/100/any' } }}
34+
icon={{ type: 'icon', name: 'help' }}
3535
/>
3636
</BottomNavigation>
3737
))

src/components/BottomNavigationAction/BottomNavigationAction.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,25 @@ import React from 'react';
44
import { componentMapper } from '@bluebase/component-mapper';
55

66
export const BottomNavigationAction = componentMapper<BottomNavigationActionProps>(MuiBottomNavigationAction, {
7-
icon: ({ icon }) => icon ? React.createElement(DynamicIcon, icon) : undefined
7+
icon: ({ icon }) => {
8+
9+
if (!icon) {
10+
return;
11+
}
12+
13+
const size = icon.size || 24;
14+
15+
const props = {
16+
size,
17+
style: {
18+
lineHeight: size,
19+
...icon.style,
20+
},
21+
...icon,
22+
};
23+
24+
return React.createElement(DynamicIcon, props);
25+
}
826
}, {
927
rest: true
1028
});

0 commit comments

Comments
 (0)