Guest User

Untitled

a guest
Nov 21st, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. import { StyleSheet, Text, View } from 'react-native'
  2. import { Link } from 'react-router-native'
  3. import { withRouter } from 'react-router'
  4.  
  5. const TabBar = ({ location, props }) => {
  6. return (
  7. <View style={styles.footer}>
  8. <Items text="Home" link="/" location={location.pathname} />
  9. <Items text="About" link="/about" location={location.pathname} />
  10. <Items text="Other" link="/other" location={location.pathname} />
  11. <Items text="Profile" link="/profile" location={location.pathname} />
  12. </View>
  13. )
  14. }
  15.  
  16. const Items = ({ text, link, location }) => (
  17. <Link
  18. to={link}
  19. underlayColor="red"
  20. activeOpacity={0}
  21. underlayColor="powderblue"
  22. >
  23. <Text style={location === link ? styles.active : styles.items}>{text}</Text>
  24. </Link>
  25. )
  26.  
  27. const styles = StyleSheet.create({
  28. footer: {
  29. backgroundColor: 'powderblue',
  30. flex: 1,
  31. height: 65,
  32. position: 'absolute',
  33. left: 0,
  34. right: 0,
  35. bottom: 0,
  36. flexDirection: 'row',
  37. justifyContent: 'space-around',
  38. borderTopColor: 'white',
  39. borderTopWidth: 1,
  40. },
  41. items: {
  42. paddingTop: 20,
  43. fontSize: 18,
  44. },
  45. active: {
  46. paddingTop: 20,
  47. fontSize: 18,
  48. color: 'white',
  49. },
  50. })
  51.  
  52. export default withRouter(TabBar)
Add Comment
Please, Sign In to add comment