Skip to content

Instantly share code, notes, and snippets.

@iRoachie
Created June 13, 2017 02:51
Show Gist options
  • Save iRoachie/5a46f26e01b143a09a46f13fffb4557b to your computer and use it in GitHub Desktop.
Save iRoachie/5a46f26e01b143a09a46f13fffb4557b to your computer and use it in GitHub Desktop.
Bottom Nav Example
import React, { Component } from 'react'
import BottomNavigation, { Tab } from 'react-native-material-bottom-navigation'
import Icon from 'react-native-vector-icons/MaterialIcons'
class MyComponent extends Component {
this.state = {
activeIndex: 0
}
render() {
return (
<BottomNavigation
labelColor="white"
rippleColor="white"
activeTab={this.state.activeIndex}
style={{ height: 56, elevation: 8, position: 'absolute', left: 0, bottom: 0, right: 0 }}
onTabChange={(newTabIndex) => this.setState({activeIndex: newTabIndex})}
>
<Tab
barBackgroundColor="#37474F"
label="Movies & TV"
icon={<Icon size={24} color="white" name="tv" />}
/>
<Tab
barBackgroundColor="#00796B"
label="Music"
icon={<Icon size={24} color="white" name="music-note" />}
/>
<Tab
barBackgroundColor="#5D4037"
label="Books"
icon={<Icon size={24} color="white" name="book" />}
/>
<Tab
barBackgroundColor="#3E2723"
label="Newsstand"
icon={<Icon size={24} color="white" name="newspaper" />}
/>
</BottomNavigation>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment