I'm using React Native Tab View, and I use renderTabBar
to display my Custom Tab Bar. So my question, how do I stay the tab bar on top of the screen even when I scroll it to down to the bottom? Just like in any apps like Twitter, Instagram etc.
Thank you for your time and help!
Here are my codes:
state = {
index: 0,
routes: [
{
key: 'first',
title: 'Images',
icon: 'ios-stats'
},
{
key: 'second',
title: 'Members',
icon: 'ios-remove'
},
{
key: 'third',
title: 'Views',
icon: 'ios-map'
}
]
};
_renderScene = SceneMap({
first: FirstTab,
second: SecondTab,
third: ThirdTab
});
_renderIcon = ({ route }) => {
return (
<Icon name={route.icon} size={24} color='black' />
);
};
render() {
return (
<TabView
navigationState={this.state}
renderScene={this._renderScene}
onIndexChange={index => this.setState({ index })}
initialLayout={{ width: Dimensions.get('window').width }}
renderTabBar={props =>
<TabBar
{...props}
indicatorStyle={{backgroundColor: 'red'}}
renderIcon={
// props => getTabBarIcon(props)
this._renderIcon
}
tabStyle={styles.bubble}
labelStyle={styles.noLabel}
/>
}
render
lazy={true}
scrollEnabled={true}
bounces={true}
/>
);