react-native-navigation的迁移库

Layout.ts 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. import { Options } from './Options';
  2. export interface LayoutComponent<P = {}> {
  3. /**
  4. * Component reference id, Auto generated if empty
  5. */
  6. id?: string;
  7. /**
  8. * Name of your component
  9. */
  10. name: string | number;
  11. /**
  12. * Styling options
  13. */
  14. options?: Options;
  15. /**
  16. * Properties to pass down to the component
  17. */
  18. passProps?: P;
  19. }
  20. export interface LayoutStackChildren {
  21. /**
  22. * Set component
  23. */
  24. component?: LayoutComponent;
  25. /**
  26. * Set the external component
  27. */
  28. externalComponent?: ExternalComponent;
  29. }
  30. export interface LayoutStack {
  31. /**
  32. * Set ID of the stack so you can use Navigation.mergeOptions to
  33. * update options
  34. */
  35. id?: string;
  36. /**
  37. * Set children screens
  38. */
  39. children?: LayoutStackChildren[];
  40. /**
  41. * Set options
  42. */
  43. options?: Options;
  44. }
  45. export interface LayoutTabsChildren {
  46. /**
  47. * Set stack
  48. */
  49. stack?: LayoutStack;
  50. /**
  51. * Set component
  52. */
  53. component?: LayoutComponent;
  54. /**
  55. * Set the external component
  56. */
  57. externalComponent?: ExternalComponent;
  58. }
  59. export interface LayoutBottomTabs {
  60. /**
  61. * Set ID of the stack so you can use Navigation.mergeOptions to
  62. * update options
  63. */
  64. id?: string;
  65. /**
  66. * Set the children screens
  67. */
  68. children?: LayoutTabsChildren[];
  69. /**
  70. * Set the bottom tabs options
  71. */
  72. options?: Options;
  73. }
  74. export interface LayoutSideMenu {
  75. /**
  76. * Set ID of the stack so you can use Navigation.mergeOptions to
  77. * update options
  78. */
  79. id?: string;
  80. /**
  81. * Set the left side bar
  82. */
  83. left?: LayoutStackChildren;
  84. /**
  85. * Set the center view
  86. */
  87. center: Layout;
  88. /**
  89. * Set the right side bar
  90. */
  91. right?: LayoutStackChildren;
  92. /**
  93. * Set the bottom tabs options
  94. */
  95. options?: Options;
  96. }
  97. export interface LayoutSplitView {
  98. /**
  99. * Set ID of the stack so you can use Navigation.mergeOptions to
  100. * update options
  101. */
  102. id?: string;
  103. /**
  104. * Set master layout (the smaller screen, sidebar)
  105. */
  106. master?: Layout;
  107. /**
  108. * Set detail layout (the larger screen, flexes)
  109. */
  110. detail?: Layout;
  111. /**
  112. * Configure split view
  113. */
  114. options?: Options;
  115. }
  116. export interface LayoutTopTabs {
  117. /**
  118. * Set the layout's id so Navigation.mergeOptions can be used to update options
  119. */
  120. id?: string;
  121. /**
  122. * Set the children screens
  123. */
  124. children?: LayoutTabsChildren[];
  125. /**
  126. * Configure top tabs
  127. */
  128. options?: Options;
  129. }
  130. export interface LayoutRoot {
  131. /**
  132. * Set the root
  133. */
  134. root: Layout;
  135. modals?: any;
  136. overlays?: any;
  137. }
  138. export interface ExternalComponent {
  139. /**
  140. * Set the screen's id so Navigation.mergeOptions can be used to update options
  141. */
  142. id?: string;
  143. /**
  144. * Name of your component
  145. */
  146. name: string | number;
  147. /**
  148. * Configure component options
  149. */
  150. options?: Options;
  151. /**
  152. * Properties to pass down to the component
  153. */
  154. passProps?: object;
  155. }
  156. export interface Layout<P = {}> {
  157. /**
  158. * Set the component
  159. */
  160. component?: LayoutComponent<P>;
  161. /**
  162. * Set the stack
  163. */
  164. stack?: LayoutStack;
  165. /**
  166. * Set the bottom tabs
  167. */
  168. bottomTabs?: LayoutBottomTabs;
  169. /**
  170. * Set the side menu
  171. */
  172. sideMenu?: LayoutSideMenu;
  173. /**
  174. * Set the split view
  175. */
  176. splitView?: LayoutSplitView;
  177. /**
  178. * Set the top tabs
  179. */
  180. topTabs?: LayoutTopTabs;
  181. /**
  182. * Set the external component
  183. */
  184. externalComponent?: ExternalComponent;
  185. }