feat: add iconStyle prop to bottom tab bar options (#8188)

Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
This commit is contained in:
Guilherme Pacheco
2020-06-15 14:11:03 -03:00
committed by GitHub
parent 33476b9cb5
commit 4480d2fe04
3 changed files with 15 additions and 1 deletions

View File

@@ -172,6 +172,10 @@ export type BottomTabBarOptions = {
* Style object for the tab label.
*/
labelStyle?: StyleProp<TextStyle>;
/**
* Style object for the tab icon.
*/
iconStyle?: StyleProp<TextStyle>;
/**
* Style object for the tab container.
*/

View File

@@ -44,6 +44,7 @@ export default function BottomTabBar({
keyboardHidesTabBar = false,
labelPosition,
labelStyle,
iconStyle,
safeAreaInsets,
showIcon,
showLabel,
@@ -286,6 +287,7 @@ export default function BottomTabBar({
showIcon={showIcon}
showLabel={showLabel}
labelStyle={labelStyle}
iconStyle={iconStyle}
style={tabStyle}
/>
</NavigationRouteContext.Provider>

View File

@@ -102,6 +102,10 @@ type Props = {
* Style object for the label element.
*/
labelStyle?: StyleProp<TextStyle>;
/**
* Style object for the icon element.
*/
iconStyle?: StyleProp<ViewStyle>;
/**
* Style object for the wrapper element.
*/
@@ -168,6 +172,7 @@ export default function BottomTabBarItem({
showIcon = true,
allowFontScaling,
labelStyle,
iconStyle,
style,
}: Props) {
const { colors } = useTheme();
@@ -226,7 +231,10 @@ export default function BottomTabBarItem({
activeTintColor={activeTintColor}
inactiveTintColor={inactiveTintColor}
renderIcon={icon}
style={horizontal ? styles.iconHorizontal : styles.iconVertical}
style={[
horizontal ? styles.iconHorizontal : styles.iconVertical,
iconStyle,
]}
/>
);
};