Skip to content
Merged
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
16 changes: 11 additions & 5 deletions src/components/tabController/TabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Constants, asBaseComponent, forwardRef, BaseComponentInjectedProps, Forw
import View from '../view';
import {Colors, Spacings, Typography} from '../../style';
import FadedScrollView from '../fadedScrollView';

import {FaderProps} from '../fader';
import useScrollToItem from './useScrollToItem';
import {orientations} from '../../commons/Constants';
import {useDidUpdate} from 'hooks';
Expand All @@ -27,6 +27,8 @@ const DEFAULT_SELECTED_LABEL_STYLE = {
letterSpacing: 0
};

const DEFAULT_FADER_PROPS = {size: 76, tintColor: Colors.$backgroundElevated};

export interface TabControllerBarProps {
/**
* The list of tab bar items
Expand Down Expand Up @@ -85,6 +87,10 @@ export interface TabControllerBarProps {
* The TabBar background Color
*/
backgroundColor?: string;
/**
* Props for the start \ end faders
*/
faderProps?: Pick<FaderProps, 'size' | 'tintColor'>;
/**
* The TabBar container width
*/
Expand Down Expand Up @@ -121,8 +127,6 @@ interface Props extends TabControllerBarProps, BaseComponentInjectedProps, Forwa
children?: ChildProps[] | ChildProps;
}

const FADER_PROPS = {size: 76, tintColor: Colors.$backgroundElevated};

/**
* @description: TabController's TabBar component
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TabControllerScreen/index.tsx
Expand All @@ -143,6 +147,7 @@ const TabBar = (props: Props) => {
selectedIconColor,
activeBackgroundColor,
backgroundColor,
faderProps,
containerWidth: propsContainerWidth,
centerSelected,
spreadItems,
Expand Down Expand Up @@ -292,9 +297,9 @@ const TabBar = (props: Props) => {
horizontal
showsHorizontalScrollIndicator={false}
showStartFader
startFaderProps={FADER_PROPS}
startFaderProps={faderProps}
showEndFader
endFaderProps={FADER_PROPS}
endFaderProps={faderProps}
contentContainerStyle={scrollViewContainerStyle}
testID={testID}
onContentSizeChange={onContentSizeChange}
Expand All @@ -314,6 +319,7 @@ TabBar.defaultProps = {
labelStyle: DEFAULT_LABEL_STYLE,
selectedLabelStyle: DEFAULT_SELECTED_LABEL_STYLE,
backgroundColor: DEFAULT_BACKGROUND_COLOR,
faderProps: DEFAULT_FADER_PROPS,
spreadItems: true
};

Expand Down