react-native-navigation的迁移库

app.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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: 'example.FirstTabScreen',
  13. icon: require('../img/one.png'),
  14. selectedIcon: require('../img/one_selected.png'),
  15. title: 'Screen One'
  16. },
  17. {
  18. label: 'Two',
  19. screen: 'example.SecondTabScreen',
  20. icon: require('../img/two.png'),
  21. selectedIcon: require('../img/two_selected.png'),
  22. title: 'Screen Two',
  23. navigatorStyle: {
  24. tabBarBackgroundColor: '#4dbce9',
  25. }
  26. }
  27. ];
  28. if (Platform.OS === 'android') {
  29. tabs.push({
  30. label: 'Collapsing',
  31. screen: 'example.CollapsingTopBarScreen',
  32. icon: require('../img/one.png'),
  33. title: 'Collapsing',
  34. });
  35. }
  36. return tabs;
  37. };
  38. // this will start our app
  39. Navigation.startTabBasedApp({
  40. tabs: createTabs(),
  41. appStyle: {
  42. tabBarBackgroundColor: '#0f2362',
  43. tabBarButtonColor: '#ffffff',
  44. tabBarSelectedButtonColor: '#63d7cc'
  45. },
  46. drawer: {
  47. left: {
  48. screen: 'example.SideMenu'
  49. }
  50. }
  51. });
  52. //Navigation.startSingleScreenApp({
  53. // screen: {
  54. // screen: 'example.FirstTabScreen',
  55. // title: 'Navigation',
  56. // navigatorStyle: {
  57. // navBarBackgroundColor: '#4dbce9',
  58. // navBarTextColor: '#ffff00',
  59. // navBarSubtitleTextColor: '#ff0000',
  60. // navBarButtonColor: '#ffffff',
  61. // statusBarTextColorScheme: 'light'
  62. // }
  63. // },
  64. // drawer: {
  65. // left: {
  66. // screen: 'example.SideMenu'
  67. // }
  68. // }
  69. //});