Skip to content

Commit 795528d

Browse files
authored
TabBarItem - allow passing style (solves issue ##874) (#907)
1 parent 645b85e commit 795528d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

demo/src/screens/componentScreens/TabBarScreen.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ export default class TabBarScreen extends Component {
133133
</TabBar>
134134

135135
<TabBar style={styles.tabbar} selectedIndex={0} enableShadow>
136-
<TabBar.Item label="Fixed" uppercase/>
137-
<TabBar.Item label="Tab" badge={{label: '100'}} uppercase/>
138-
<TabBar.Item label="Bar" uppercase/>
136+
<TabBar.Item label="Fixed" uppercase style={{backgroundColor: Colors.blue80}}/>
137+
<TabBar.Item label="Tab" badge={{label: '100'}} uppercase style={{backgroundColor: Colors.blue80}}/>
138+
<TabBar.Item label="Bar" uppercase style={{backgroundColor: Colors.blue80}}/>
139139
</TabBar>
140140

141141
<TabBar style={styles.tabbar} selectedIndex={0} enableShadow>

src/components/tabBar/TabBarItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ class TabBarItem extends PureComponent<TabBarItemProps, State> {
173173
width,
174174
onPress,
175175
activeBackgroundColor,
176+
style,
176177
testID
177178
} = this.props;
178179

@@ -186,7 +187,7 @@ class TabBarItem extends PureComponent<TabBarItemProps, State> {
186187
<TouchableOpacity
187188
activeOpacity={1}
188189
onPress={onPress}
189-
style={width ? {width} : {flex: 1}}
190+
style={[style, width ? {width} : {flex: 1}]}
190191
testID={testID}
191192
activeBackgroundColor={activeBackgroundColor}
192193
onLayout={this.onLayout}

0 commit comments

Comments
 (0)