Index.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. const TITLE_OFFSET = Platform.OS === 'ios' ? 70 : 56;
  7. const HomeStack = createStackNavigator({
  8. DesktopHome: {
  9. screen: DesktopHome,
  10. navigationOptions: {
  11. title: '电金睛'
  12. },
  13. },
  14. },
  15. {
  16. defaultNavigationOptions: {
  17. headerStyle: {
  18. backgroundColor: "#5394e4",
  19. borderBottomWidth: 0,
  20. borderColor: '#ccc',
  21. fontColor: '#fff',
  22. elevation: 0,
  23. height: 50
  24. },
  25. headerTintColor: '#ffffff',
  26. headerTitleStyle: {
  27. fontWeight: 'normal',
  28. fontSize: 18,
  29. color: '#ffffff',
  30. alignSelf:'center',
  31. textAlign: 'center',
  32. flex:1
  33. },
  34. headerTitleContainerStyle:{
  35. left: TITLE_OFFSET,
  36. right: TITLE_OFFSET,
  37. },
  38. headerBackTitle: null // ~注意~ 这个地方是隐藏返回按钮文字的
  39. }
  40. })
  41. HomeStack.navigationOptions = ({ navigation }) => { // ~注意~ 如果想实现隐藏Tabbar的功能要调用这个方法
  42. let tabBarVisible = true
  43. if (navigation.state.index > 0) {
  44. tabBarVisible = false
  45. }
  46. return {
  47. tabBarVisible
  48. }
  49. }
  50. module.exports = HomeStack