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
10 changes: 9 additions & 1 deletion src/components/tabController/TabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import _ from 'lodash';

import TabBarContext from './TabBarContext';
import TabBarItem, {TabControllerItemProps} from './TabBarItem';
import {Constants, asBaseComponent, forwardRef, BaseComponentInjectedProps, ForwardRefInjectedProps} from '../../commons/new';
import {
Constants,
asBaseComponent,
forwardRef,
BaseComponentInjectedProps,
ForwardRefInjectedProps
} from '../../commons/new';
import View from '../view';
import {Colors, Spacings, Typography} from '../../style';
import FadedScrollView from '../fadedScrollView';
Expand Down Expand Up @@ -210,6 +216,7 @@ const TabBar = (props: Props) => {
uppercase={uppercase}
iconColor={iconColor}
selectedIconColor={selectedIconColor}
backgroundColor={backgroundColor}
activeBackgroundColor={activeBackgroundColor}
{...item}
{...context}
Expand All @@ -228,6 +235,7 @@ const TabBar = (props: Props) => {
uppercase,
iconColor,
selectedIconColor,
backgroundColor,
activeBackgroundColor,
centerSelected,
onItemLayout
Expand Down
7 changes: 6 additions & 1 deletion src/components/tabController/TabBarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export interface TabControllerItemProps {
* The active opacity when pressing a tab
*/
activeOpacity?: number;
/**
* Apply background color for the tab bar item
*/
backgroundColor?: string;
/**
* TODO: rename to feedbackColor
* Apply background color on press for TouchableOpacity
Expand Down Expand Up @@ -118,6 +122,7 @@ export default function TabBarItem({
trailingAccessory,
uppercase,
activeOpacity = 0.9,
backgroundColor = Colors.$backgroundElevated,
activeBackgroundColor,
testID,
ignore,
Expand Down Expand Up @@ -192,8 +197,8 @@ export default function TabBarItem({
// @ts-expect-error
ref={itemRef}
style={_style}
bg-$backgroundElevated
onLayout={onLayout}
backgroundColor={backgroundColor}
activeBackgroundColor={activeBackgroundColor}
activeOpacity={activeOpacity}
onPress={onPress}
Expand Down
16 changes: 12 additions & 4 deletions src/components/tabController/apis/tabBarItem.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
{"name": "labelStyle;", "type": "TextStyle", "description": "Custom label style"},
{"name": "selectedLabelStyle", "type": "TextStyle", "description": "Custom selected label style"},
{"name": "labelColor", "type": "string", "description": "The default label color", "default": "Colors.black"},
{"name": "selectedLabelColor", "type": "string", "description": "The selected label color", "default": "Colors.primary"},
{
"name": "selectedLabelColor",
"type": "string",
"description": "The selected label color",
"default": "Colors.primary"
},
{"name": "icon", "type": "number", "description": "Icon of the tab"},
{"name": "iconColor", "type": "string", "description": "Icon tint color"},
{"name": "selectedIconColor", "type": "string", "description": "Icon selected tint color"},
Expand All @@ -21,6 +26,11 @@
{"name": "onPress", "type": "(index: number) => void", "description": "Callback for when pressing a tab"},
{"name": "uppercase", "type": "boolean", "description": "Whether to change the text to uppercase"},
{"name": "activeOpacity", "type": "number", "description": "The active opacity when pressing a tab"},
{
"name": "backgroundColor",
"type": "string",
"description": " Apply background color for the tab bar item"
},
{
"name": "activeBackgroundColor",
"type": "string",
Expand All @@ -29,7 +39,5 @@
{"name": "style", "type": "ViewStyle", "description": "Pass custom style"},
{"name": "testID", "type": "string", "description": "Used as a testing identifier"}
],
"snippet": [
"<TabBarItem label={$1}/>"
]
"snippet": ["<TabBarItem label={$1}/>"]
}