I have the default blue header color and the yellow underline color.
I want to add styles to the tab title and style it like a button
`import * as React from 'react';
import { View, StyleSheet, Dimensions } from 'react-native';
import { TabView, SceneMap } from 'react-native-tab-view';
const FirstRoute = () => (
);
const SecondRoute = () => (
);
const ThirdRoute = () => (
);
export default class TabViewExample extends React.Component {
state = {
index: 0,
routes: [
{ key: 'first', title: 'First' },
{ key: 'second', title: 'Second' },
{ key: 'third', title: 'Third' },
],
};
render() {
return (
renderScene={SceneMap({
first: FirstRoute,
second: SecondRoute,
third:ThirdRoute
})}
onIndexChange={index => this.setState({ index })}
initialLayout={{ width: Dimensions.get('window').width }}
/>
);
}
}
const styles = StyleSheet.create({
scene: {
flex: 1,
},
});`
I am stuck at this point since the documentation didn't we can do that.
| software | version
| --------------------- | -------
| ios or android | oreo
| react-native | 0.57
| react-native-tab-view | 1.3.2
| node |
| npm or yarn |
TabBar accepts a style prop to change styles such as background color, tabStyle to style individual tabs, and indicatorStyle for indicator. If these props aren't enough for you, you can also make a custom tab bar https://snack.expo.io/@satya164/react-native-tab-view-custom-tabbar
renderScene={SceneMap({
first: FirstRoute,
second: SecondRoute,
third:ThirdRoute
})}
onIndexChange={index => this.setState({ index })}
initialLayout={{ width: Dimensions.get('window').width }}
style={{backgroundColor:'#333333'}}
/>
check this code, I used TabView and adding a style to the TabView still changes nothing here.The color is still blue.Assist
TabView style doesn't work as expected,I just need to change the backgroud color for the TabView
como se cambia el color, tengo que usar tabBar??
Most helpful comment
TabView style doesn't work as expected,I just need to change the backgroud color for the TabView