react-native-navigation的迁移库

app.js 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. startApp: {
  27. y: {
  28. from: 1000,
  29. to: 0,
  30. duration: 500,
  31. interpolation: 'accelerate',
  32. },
  33. alpha: {
  34. from: 0,
  35. to: 1,
  36. duration: 500,
  37. interpolation: 'accelerate'
  38. }
  39. },
  40. push: {
  41. topBar: {
  42. id: 'TEST',
  43. alpha: {
  44. from: 0,
  45. to: 1,
  46. duration: 500,
  47. interpolation: 'accelerate'
  48. }
  49. },
  50. bottomTabs: {
  51. y: {
  52. from: 1000,
  53. to: 0,
  54. duration: 500,
  55. interpolation: 'decelerate',
  56. },
  57. alpha: {
  58. from: 0,
  59. to: 1,
  60. duration: 500,
  61. interpolation: 'decelerate'
  62. }
  63. },
  64. bottomTabs: {
  65. y: {
  66. from: 1000,
  67. to: 0,
  68. duration: 500,
  69. interpolation: 'decelerate',
  70. },
  71. alpha: {
  72. from: 0,
  73. to: 1,
  74. duration: 500,
  75. interpolation: 'decelerate'
  76. }
  77. },
  78. content: {
  79. y: {
  80. from: 1000,
  81. to: 0,
  82. duration: 500,
  83. interpolation: 'accelerate',
  84. },
  85. alpha: {
  86. from: 0,
  87. to: 1,
  88. duration: 500,
  89. interpolation: 'accelerate'
  90. }
  91. }
  92. },
  93. pop: {
  94. topBar: {
  95. id: 'TEST',
  96. alpha: {
  97. from: 1,
  98. to: 0,
  99. duration: 500,
  100. interpolation: 'accelerate'
  101. }
  102. },
  103. bottomTabs: {
  104. y: {
  105. from: 0,
  106. to: 100,
  107. duration: 500,
  108. interpolation: 'accelerate',
  109. },
  110. alpha: {
  111. from: 1,
  112. to: 0,
  113. duration: 500,
  114. interpolation: 'accelerate'
  115. }
  116. },
  117. bottomTabs: {
  118. y: {
  119. from: 0,
  120. to: 100,
  121. duration: 500,
  122. interpolation: 'decelerate',
  123. },
  124. alpha: {
  125. from: 1,
  126. to: 0,
  127. duration: 500,
  128. interpolation: 'decelerate'
  129. }
  130. },
  131. content: {
  132. y: {
  133. from: 0,
  134. to: 1000,
  135. duration: 500,
  136. interpolation: 'decelerate',
  137. },
  138. alpha: {
  139. from: 1,
  140. to: 0,
  141. duration: 500,
  142. interpolation: 'decelerate'
  143. }
  144. }
  145. }
  146. }
  147. });
  148. Navigation.setRoot({
  149. stack: {
  150. id: 'TEST',
  151. children: [
  152. {
  153. component: {
  154. name: 'navigation.playground.WelcomeScreen'
  155. }
  156. }
  157. ]
  158. }
  159. });
  160. });
  161. }
  162. module.exports = {
  163. start
  164. };