react-native-navigation的迁移库

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. const { Navigation } = require('react-native-navigation');
  2. const { registerScreens } = require('./screens');
  3. const { Platform } = require('react-native');
  4. if (Platform.OS === 'android') {
  5. alert = (title) => {
  6. Navigation.showOverlay({
  7. component: {
  8. name: 'navigation.playground.alert',
  9. passProps: {
  10. title
  11. },
  12. options: {
  13. overlay: {
  14. interceptTouchOutside: true
  15. }
  16. }
  17. }
  18. });
  19. };
  20. }
  21. function start() {
  22. registerScreens();
  23. Navigation.events().onAppLaunched(() => {
  24. Navigation.setDefaultOptions({
  25. _animations: {
  26. push: {
  27. topBar: {
  28. y: {
  29. from: 1000,
  30. to: 0,
  31. duration: 500,
  32. interpolation: 'accelerate',
  33. },
  34. alpha: {
  35. from: 0,
  36. to: 1,
  37. duration: 500,
  38. interpolation: 'accelerate'
  39. }
  40. },
  41. content: {
  42. y: {
  43. from: 1000,
  44. to: 0,
  45. duration: 500,
  46. interpolation: 'accelerate',
  47. },
  48. alpha: {
  49. from: 0,
  50. to: 1,
  51. duration: 500,
  52. interpolation: 'accelerate'
  53. }
  54. }
  55. },
  56. pop: {
  57. topBar: {
  58. y: {
  59. from: 0,
  60. to: 100,
  61. duration: 500,
  62. interpolation: 'decelerate',
  63. },
  64. alpha: {
  65. from: 1,
  66. to: 0,
  67. duration: 500,
  68. interpolation: 'decelerate'
  69. }
  70. },
  71. content: {
  72. y: {
  73. from: 0,
  74. to: 1000,
  75. duration: 500,
  76. interpolation: 'decelerate',
  77. },
  78. alpha: {
  79. from: 1,
  80. to: 0,
  81. duration: 500,
  82. interpolation: 'decelerate'
  83. }
  84. }
  85. }
  86. }
  87. });
  88. Navigation.setRoot({
  89. stack: {
  90. children: [
  91. {
  92. component: {
  93. name: 'navigation.playground.WelcomeScreen'
  94. }
  95. }
  96. ]
  97. }
  98. });
  99. });
  100. }
  101. module.exports = {
  102. start
  103. };