HomePage.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import React from "react"
  2. import { StyleSheet } from "react-native"
  3. import { createBottomTabNavigator } from "react-navigation-tabs"
  4. import { createAppContainer } from "react-navigation"
  5. import MainPage from "./MainPage"
  6. import MessagePage from "./MessagePage"
  7. import GamePage from "./GamePage"
  8. import MyPage from "../page/MyPage"
  9. import Entypo from "react-native-vector-icons/Entypo"
  10. import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons"
  11. import AntDesign from "react-native-vector-icons/AntDesign"
  12. export default class HomePage extends React.Component {
  13. _tabNavigator() {
  14. return createAppContainer(
  15. createBottomTabNavigator({
  16. MainPage: {
  17. screen: MainPage,
  18. navigationOptions: {
  19. tabBarLabel: "主页",
  20. tabBarIcon: ({ tintColor, focused }) => (
  21. <MaterialCommunityIcons
  22. name={"home-heart"}
  23. size={26}
  24. style={{ color: tintColor }}
  25. />
  26. )
  27. }
  28. },
  29. MessagePage: {
  30. screen: MessagePage,
  31. navigationOptions: {
  32. tabBarLabel: "消息",
  33. tabBarIcon: ({ tintColor, focused }) => (
  34. <AntDesign
  35. name={"message1"}
  36. size={26}
  37. style={{ color: tintColor }}
  38. />
  39. )
  40. }
  41. },
  42. GamePage: {
  43. screen: GamePage,
  44. navigationOptions: {
  45. tabBarLabel: "游戏",
  46. tabBarIcon: ({ tintColor, focused }) => (
  47. <Entypo
  48. name={"game-controller"}
  49. size={26}
  50. style={{ color: tintColor }}
  51. />
  52. )
  53. }
  54. },
  55. MyPage: {
  56. screen: MyPage,
  57. navigationOptions: {
  58. tabBarLabel: "我的",
  59. tabBarIcon: ({ tintColor, focused }) => (
  60. <AntDesign
  61. name={"smileo"}
  62. size={26}
  63. style={{ color: tintColor }}
  64. />
  65. )
  66. }
  67. }
  68. })
  69. )
  70. }
  71. render() {
  72. const Tab = this._tabNavigator()
  73. return <Tab />
  74. }
  75. }
  76. const styles = StyleSheet.create({
  77. container: {
  78. flex: 1,
  79. justifyContent: "center",
  80. alignItems: "center",
  81. backgroundColor: "#0f0"
  82. }
  83. })