MyGift.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import React, { Component } from "react"
  2. import { StyleSheet } from "react-native"
  3. import { unitWidth } from "../utils/AdapterUtil";
  4. import { createMaterialTopTabNavigator } from "react-navigation-tabs"
  5. import { createAppContainer } from 'react-navigation';
  6. import GetGift from './GetGift'
  7. import SendGift from './SendGift'
  8. export default class MyGift extends Component {
  9. _tabNavigator() {
  10. return createAppContainer(
  11. createMaterialTopTabNavigator(
  12. {//在这里配置页面的路由
  13. GetGift: {
  14. screen: GetGift,
  15. navigationOptions: {
  16. tabBarLabel: '收到的礼物'
  17. }
  18. },
  19. SendGift: {
  20. screen: SendGift,
  21. navigationOptions: {
  22. tabBarLabel: '送出的礼物'
  23. }
  24. },
  25. },
  26. {
  27. tabBarOptions: {
  28. activeTintColor: 'white',//label和icon的前景色 活跃状态下(选中)
  29. inactiveTintColor: '#FFD1D1',//label和icon的前景色 活跃状态下(未选中)
  30. style: {
  31. backgroundColor: '#FB788A',//TabBar 的背景颜色
  32. },
  33. indicatorStyle: {
  34. height: 2,
  35. backgroundColor: '#fff',
  36. },//标签指示器的样式
  37. labelStyle: {
  38. fontSize: unitWidth * 28,
  39. // marginTop: unitHeight * 37,
  40. // marginBottom: unitHeight * 31,
  41. },//文字的样式
  42. },
  43. }
  44. )
  45. )
  46. }
  47. render() {
  48. const Tab = this._tabNavigator()
  49. return <Tab />
  50. }
  51. }
  52. const styles = StyleSheet.create({
  53. container: {
  54. flex: 1,
  55. justifyContent: "center",
  56. alignItems: "center"
  57. }
  58. })