react-native-navigation的迁移库

app.js 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import {
  2. Platform
  3. } from 'react-native';
  4. import {Navigation} from 'react-native-navigation';
  5. // screen related book keeping
  6. import {registerScreens} from './screens';
  7. registerScreens();
  8. const createTabs = () => {
  9. let tabs = [
  10. {
  11. label: 'One',
  12. screen: 'com.example.FirstTabScreen',
  13. icon: require('../img/one.png'),
  14. selectedIcon: require('../img/one_selected.png'),
  15. title: 'Screen One',
  16. navigatorStyle: {
  17. tabBarHidden: true
  18. }
  19. },
  20. {
  21. label: 'Two',
  22. screen: 'com.example.SecondTabScreen',
  23. icon: require('../img/two.png'),
  24. selectedIcon: require('../img/two_selected.png'),
  25. title: 'Screen Two',
  26. navigatorStyle: {
  27. tabBarBackgroundColor: '#4dbce9',
  28. }
  29. }
  30. ];
  31. if (Platform.OS === 'android') {
  32. tabs.push({
  33. label: 'Collapsing',
  34. screen: 'example.CollapsingTopBarScreen',
  35. icon: require('../img/one.png'),
  36. title: 'Collapsing',
  37. });
  38. }
  39. return tabs;
  40. };
  41. import * as Commands from './../node_modules/react-native-navigation/src2/commands/valid-commands';
  42. //Navigation.startApp(Commands.singleScreenApp);
  43. //Navigation.startApp(Commands.tabBasedApp);
  44. //Navigation.startApp(Commands.singleWithSideMenu);
  45. //Navigation.startApp(Commands.singleWithRightSideMenu);
  46. //Navigation.startApp(Commands.singleWithBothMenus);
  47. //Navigation.startApp(Commands.tabBasedWithSideMenu);
  48. // this will start our app
  49. Navigation.startTabBasedApp({
  50. tabs: createTabs(),
  51. appStyle: {
  52. tabBarBackgroundColor: '#0f2362',
  53. tabBarButtonColor: '#ffffff',
  54. tabBarSelectedButtonColor: '#63d7cc',
  55. },
  56. drawer: {
  57. left: {
  58. screen: 'com.example.SideMenu'
  59. }
  60. }
  61. });
  62. //Navigation.startSingleScreenApp({
  63. // screen: {
  64. // screen: 'com.example.FirstTabScreen',
  65. // title: 'Navigation',
  66. // navigatorStyle: {
  67. // navBarBackgroundColor: '#4dbce9',
  68. // navBarTextColor: '#ffff00',
  69. // navBarSubtitleTextColor: '#ff0000',
  70. // navBarButtonColor: '#ffffff',
  71. // statusBarTextColorScheme: 'light',
  72. // tabBarHidden: true
  73. // }
  74. // },
  75. // drawer: {
  76. // left: {
  77. // screen: 'com.example.SideMenu'
  78. // }
  79. // }
  80. //});