Index.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. 'use strict'
  2. import React, { Component } from 'react'
  3. import { Platform } from 'react-native'
  4. import { createStackNavigator } from 'react-navigation'
  5. import DesktopHome from './Home'
  6. import SearchHome from './Search'
  7. import DeliverHome from './Deliver'
  8. import DeliverAdd from './DeliverAdd'
  9. import SearchDistributor from './SearchDistributor'
  10. import UHFDeliver from './UHFDeliver'
  11. const TITLE_OFFSET = Platform.OS === 'ios' ? 70 : 56;
  12. const HomeStack = createStackNavigator({
  13. DesktopHome: {
  14. screen: DesktopHome,
  15. navigationOptions: {
  16. title: '电金睛'
  17. },
  18. },
  19. SearchHome: {
  20. screen: SearchHome,
  21. navigationOptions: {
  22. title: '窜货查询'
  23. },
  24. },
  25. DeliverHome: {
  26. screen: DeliverHome,
  27. navigationOptions: {
  28. title: '出库'
  29. },
  30. },
  31. DeliverAdd: {
  32. screen: DeliverAdd,
  33. navigationOptions: {
  34. title: '批量添加'
  35. },
  36. },
  37. ReturnHome: {
  38. screen: DeliverHome,
  39. navigationOptions: {
  40. title: '退货'
  41. },
  42. },
  43. SearchDistributor: {
  44. screen: SearchDistributor,
  45. navigationOptions: {
  46. title: '查询经销商'
  47. },
  48. },
  49. UHFDeliver: {
  50. screen: UHFDeliver,
  51. navigationOptions: {
  52. title: '射频出库'
  53. },
  54. },
  55. UHFReturn: {
  56. screen: UHFDeliver,
  57. navigationOptions: {
  58. title: '射频退货'
  59. },
  60. },
  61. },
  62. {
  63. defaultNavigationOptions: {
  64. headerStyle: {
  65. backgroundColor: "#5394e4",
  66. borderBottomWidth: 0,
  67. borderColor: '#ccc',
  68. fontColor: '#fff',
  69. elevation: 0,
  70. height: 50
  71. },
  72. headerTintColor: '#ffffff',
  73. headerTitleStyle: {
  74. fontWeight: 'normal',
  75. fontSize: 18,
  76. color: '#ffffff',
  77. alignSelf:'center',
  78. textAlign: 'center',
  79. flex:1
  80. },
  81. headerTitleContainerStyle:{
  82. left: TITLE_OFFSET,
  83. right: TITLE_OFFSET,
  84. },
  85. headerBackTitle: null // ~注意~ 这个地方是隐藏返回按钮文字的
  86. }
  87. })
  88. HomeStack.navigationOptions = ({ navigation }) => { // ~注意~ 如果想实现隐藏Tabbar的功能要调用这个方法
  89. let tabBarVisible = true
  90. if (navigation.state.index > 0) {
  91. tabBarVisible = false
  92. }
  93. return {
  94. tabBarVisible
  95. }
  96. }
  97. module.exports = HomeStack