Skip to content

Commit f10df1b

Browse files
authored
TabController - allow sending faderProps (#2008)
1 parent 9bed84a commit f10df1b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/components/tabController/TabBar.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {Constants, asBaseComponent, forwardRef, BaseComponentInjectedProps, Forw
99
import View from '../view';
1010
import {Colors, Spacings, Typography} from '../../style';
1111
import FadedScrollView from '../fadedScrollView';
12-
12+
import {FaderProps} from '../fader';
1313
import useScrollToItem from './useScrollToItem';
1414
import {orientations} from '../../commons/Constants';
1515
import {useDidUpdate} from 'hooks';
@@ -27,6 +27,8 @@ const DEFAULT_SELECTED_LABEL_STYLE = {
2727
letterSpacing: 0
2828
};
2929

30+
const DEFAULT_FADER_PROPS = {size: 76, tintColor: Colors.$backgroundElevated};
31+
3032
export interface TabControllerBarProps {
3133
/**
3234
* The list of tab bar items
@@ -85,6 +87,10 @@ export interface TabControllerBarProps {
8587
* The TabBar background Color
8688
*/
8789
backgroundColor?: string;
90+
/**
91+
* Props for the start \ end faders
92+
*/
93+
faderProps?: Pick<FaderProps, 'size' | 'tintColor'>;
8894
/**
8995
* The TabBar container width
9096
*/
@@ -121,8 +127,6 @@ interface Props extends TabControllerBarProps, BaseComponentInjectedProps, Forwa
121127
children?: ChildProps[] | ChildProps;
122128
}
123129

124-
const FADER_PROPS = {size: 76, tintColor: Colors.$backgroundElevated};
125-
126130
/**
127131
* @description: TabController's TabBar component
128132
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TabControllerScreen/index.tsx
@@ -143,6 +147,7 @@ const TabBar = (props: Props) => {
143147
selectedIconColor,
144148
activeBackgroundColor,
145149
backgroundColor,
150+
faderProps,
146151
containerWidth: propsContainerWidth,
147152
centerSelected,
148153
spreadItems,
@@ -292,9 +297,9 @@ const TabBar = (props: Props) => {
292297
horizontal
293298
showsHorizontalScrollIndicator={false}
294299
showStartFader
295-
startFaderProps={FADER_PROPS}
300+
startFaderProps={faderProps}
296301
showEndFader
297-
endFaderProps={FADER_PROPS}
302+
endFaderProps={faderProps}
298303
contentContainerStyle={scrollViewContainerStyle}
299304
testID={testID}
300305
onContentSizeChange={onContentSizeChange}
@@ -314,6 +319,7 @@ TabBar.defaultProps = {
314319
labelStyle: DEFAULT_LABEL_STYLE,
315320
selectedLabelStyle: DEFAULT_SELECTED_LABEL_STYLE,
316321
backgroundColor: DEFAULT_BACKGROUND_COLOR,
322+
faderProps: DEFAULT_FADER_PROPS,
317323
spreadItems: true
318324
};
319325

0 commit comments

Comments
 (0)