Skip to content

Instantly share code, notes, and snippets.

@rturk
Last active March 20, 2020 18:49
Show Gist options
  • Save rturk/69568c504583439a1f5e39b0f87fc81d to your computer and use it in GitHub Desktop.
Save rturk/69568c504583439a1f5e39b0f87fc81d to your computer and use it in GitHub Desktop.
RNRF Tabbar Icon Sample
import React, {
Component,
PropTypes,
} from 'react';
import {
StatusBar,
Text,
View,
StyleSheet,
PixelRatio,
BackAndroid,
} from "react-native";
import { Router, Scene, Actions } from 'react-native-router-flux';
import Icon from 'react-native-vector-icons/FontAwesome';
class TabIcon extends Component {
render() {
const color = this.props.selected ? Globals.color : '#301c2a';
return (
<View style={{
flex:1,
alignItems:'center',
alignSelf:'center',
justifyContent: 'center',
marginBottom: -5,
}}>
<Icon style={{color: color}} name={this.props.iconName || "circle"} size={16}/>
<Text style={{color: color, fontSize: 12}}>{this.props.title}</Text>
</View>
);
}
}
<Router>
<Scene key="root">
<Scene key="tabbar" component={DrawerMenu} type="reset" duration={1} initial={true} >
<Scene key="main" tabs={true} tabBarStyle={styles.tabBar} default="newsfeed">
<Scene key="tags"
title="Tags"
iconName="tags"
icon={TabIcon}
hideNavBar={true}
component={Tags}
initial={true}
/>
<Scene key="newsfeed"
title="MAin"
iconName="newspaper-o"
icon={TabIcon}
hideNavBar={true}
component={NewsFeed}
/>
<Scene key="mynews"
title="MyFeed"
iconName="user"
icon={TabIcon}
hideNavBar={true}
component={NewsFeedUser}
/>
</Scene>
</Scene>
</Scene>
</Scene>
@juddey
Copy link

juddey commented Sep 20, 2016

Thanks for posting this, super helpful! 🎯

@sumitkcloudpanel
Copy link

Thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment