react-native-navigation的迁移库

Options.ts 21KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027
  1. // tslint:disable jsdoc-format
  2. import { ImageRequireSource, Insets } from 'react-native';
  3. type Color = string;
  4. type FontFamily = string;
  5. type FontWeight = 'regular' | 'bold' | 'thin' | 'ultraLight' | 'light' | 'medium' | 'semibold' | 'heavy' | 'black';
  6. type LayoutOrientation = 'portrait' | 'landscape';
  7. type AndroidDensityNumber = number;
  8. type SystemItemIcon = 'done' | 'cancel' | 'edit'
  9. | 'save' | 'add' | 'flexibleSpace' | 'fixedSpace'
  10. | 'compose' | 'reply' | 'action' | 'organize'
  11. | 'bookmarks' | 'search' | 'refresh' | 'stop'
  12. | 'camera' | 'trash' | 'play' | 'pause'
  13. | 'rewind' | 'fastForward' | 'undo' | 'redo';
  14. export interface OptionsSplitView {
  15. /**
  16. * Master view display mode
  17. * @default 'auto'
  18. */
  19. displayMode?: 'auto' | 'visible' | 'hidden' | 'overlay';
  20. /**
  21. * Master view side. Leading is left. Trailing is right.
  22. * @default 'leading'
  23. */
  24. primaryEdge?: 'leading' | 'trailing';
  25. /**
  26. * Set the minimum width of master view
  27. */
  28. minWidth?: number;
  29. /**
  30. * Set the maximum width of master view
  31. */
  32. maxWidth?: number;
  33. }
  34. export interface OptionsStatusBar {
  35. /**
  36. * Set the status bar visibility
  37. * @default true
  38. */
  39. visible?: boolean;
  40. /**
  41. * Set the text color of the status bar
  42. * @default 'light'
  43. */
  44. style?: 'light' | 'dark';
  45. /**
  46. * Set the background color of the status bar
  47. * #### (Android specific)
  48. */
  49. backgroundColor?: Color;
  50. /**
  51. * Draw screen behind the status bar
  52. * #### (Android specific)
  53. */
  54. drawBehind?: boolean;
  55. }
  56. export interface OptionsLayout {
  57. fitSystemWindows?: boolean;
  58. /**
  59. * Set the screen background color
  60. */
  61. backgroundColor?: Color;
  62. /**
  63. * Set background color only for components, helps reduce overdraw if background color is set in default options.
  64. * #### (Android specific)
  65. */
  66. componentBackgroundColor?: Color;
  67. /**
  68. * Set the allowed orientations
  69. */
  70. orientation?: LayoutOrientation[];
  71. /**
  72. * Layout top margin
  73. * #### (Android specific)
  74. */
  75. topMargin?: number;
  76. /**
  77. * Set language direction.
  78. * only works with DefaultOptions
  79. */
  80. direction?: 'rtl' | 'ltr';
  81. }
  82. export enum OptionsModalPresentationStyle {
  83. formSheet = 'formSheet',
  84. pageSheet = 'pageSheet',
  85. overFullScreen = 'overFullScreen',
  86. overCurrentContext = 'overCurrentContext',
  87. currentContext = 'currentContext',
  88. popOver = 'popOver',
  89. fullScreen = 'fullScreen',
  90. none = 'none'
  91. }
  92. export enum OptionsModalTransitionStyle {
  93. coverVertical = 'coverVertical',
  94. crossDissolve = 'crossDissolve',
  95. flipHorizontal = 'flipHorizontal',
  96. partialCurl = 'partialCurl'
  97. }
  98. export interface OptionsTopBarLargeTitle {
  99. /**
  100. * Enable large titles
  101. */
  102. visible?: boolean;
  103. /**
  104. * Set the font size of large title's text
  105. */
  106. fontSize?: number;
  107. /**
  108. * Set the color of large title's text
  109. */
  110. color?: Color;
  111. /**
  112. * Set the font family of large title's text
  113. */
  114. fontFamily?: FontFamily;
  115. /**
  116. * Set the font weight, ignore fontFamily and use the iOS system fonts instead
  117. * #### (iOS specific)
  118. */
  119. fontWeight?: FontWeight;
  120. }
  121. export interface OptionsTopBarTitle {
  122. /**
  123. * Text to display in the title area
  124. */
  125. text?: string;
  126. /**
  127. * Font size
  128. */
  129. fontSize?: number;
  130. /**
  131. * Text color
  132. */
  133. color?: Color;
  134. /**
  135. * Title font family
  136. *
  137. * Make sure that the font is available
  138. */
  139. fontFamily?: FontFamily;
  140. /**
  141. * Set the font weight, ignore fontFamily and use the iOS system fonts instead
  142. * #### (iOS specific)
  143. */
  144. fontWeight?: FontWeight;
  145. /**
  146. * Custom component as the title view
  147. */
  148. component?: {
  149. /**
  150. * Component reference id, Auto generated if empty
  151. */
  152. id?: string;
  153. /**
  154. * Name of your component
  155. */
  156. name: string;
  157. /**
  158. * Set component alignment
  159. */
  160. alignment?: 'center' | 'fill';
  161. /**
  162. * Properties to pass down to the component
  163. */
  164. passProps?: object;
  165. };
  166. /**
  167. * Top Bar title height in densitiy pixels
  168. * #### (Android specific)
  169. */
  170. height?: number;
  171. /**
  172. * Title alignment
  173. * #### (Android specific)
  174. */
  175. alignment?: 'center' | 'fill';
  176. }
  177. export interface OptionsTopBarSubtitle {
  178. /**
  179. * Set subtitle text
  180. */
  181. text?: string;
  182. /**
  183. * Set subtitle font size
  184. */
  185. fontSize?: number;
  186. /**
  187. * Set subtitle color
  188. */
  189. color?: Color;
  190. /**
  191. * Set subtitle font family
  192. */
  193. fontFamily?: FontFamily;
  194. /**
  195. * Set the font weight, ignore fontFamily and use the iOS system fonts instead
  196. * #### (iOS specific)
  197. */
  198. fontWeight?: FontWeight;
  199. /**
  200. * Set subtitle alignment
  201. */
  202. alignment?: 'center';
  203. }
  204. export interface OptionsTopBarBackButton {
  205. /**
  206. * Image to show as the back button
  207. */
  208. icon?: ImageRequireSource;
  209. /**
  210. * Weither the back button is visible or not
  211. * @default true
  212. */
  213. visible?: boolean;
  214. /**
  215. * Set the back button title
  216. * #### (iOS specific)
  217. */
  218. title?: string;
  219. /**
  220. * Show title or just the icon
  221. * #### (iOS specific)
  222. */
  223. showTitle?: boolean;
  224. /**
  225. * Back button icon and text color
  226. */
  227. color?: Color;
  228. }
  229. export interface OptionsTopBarBackground {
  230. /**
  231. * Background color of the top bar
  232. */
  233. color?: Color;
  234. /**
  235. * Clip the top bar background to bounds if set to true.
  236. * #### (iOS specific)
  237. */
  238. clipToBounds?: boolean;
  239. /**
  240. * Set a custom component for the Top Bar background
  241. */
  242. component?: {
  243. name?: string;
  244. /**
  245. * Properties to pass down to the component
  246. */
  247. passProps?: object;
  248. };
  249. /**
  250. * Allows the NavBar to be translucent (blurred)
  251. * #### (iOS specific)
  252. */
  253. translucent?: boolean;
  254. /**
  255. * Enable background blur
  256. * #### (iOS specific)
  257. */
  258. blur?: boolean;
  259. }
  260. export interface OptionsTopBarButton {
  261. /**
  262. * Button id for reference press event
  263. */
  264. id: string;
  265. /**
  266. * Set the button icon
  267. */
  268. icon?: ImageRequireSource;
  269. /**
  270. * Set the button icon insets
  271. */
  272. iconInsets?: IconInsets;
  273. /**
  274. * Set the button as a custom component
  275. */
  276. component?: {
  277. name: string;
  278. /**
  279. * Properties to pass down to the component
  280. */
  281. passProps?: object;
  282. };
  283. /**
  284. * (iOS only) Set the button as an iOS system icon
  285. */
  286. systemItem?: SystemItemIcon;
  287. /**
  288. * Set the button text
  289. */
  290. text?: string;
  291. /**
  292. * Set the button font family
  293. */
  294. fontFamily?: string;
  295. /**
  296. * Set the font weight, ignore fontFamily and use the iOS system fonts instead
  297. * #### (iOS specific)
  298. */
  299. fontWeight?: FontWeight;
  300. /**
  301. * Set the button enabled or disabled
  302. * @default true
  303. */
  304. enabled?: boolean;
  305. /**
  306. * Disable icon tinting
  307. */
  308. disableIconTint?: boolean;
  309. /**
  310. * Set text color
  311. */
  312. color?: Color;
  313. /**
  314. * Set text color in disabled state
  315. */
  316. disabledColor?: Color;
  317. /**
  318. * Set testID for reference in E2E tests
  319. */
  320. testID?: string;
  321. /**
  322. * (Android only) Set showAsAction value
  323. * @see {@link https://developer.android.com/guide/topics/resources/menu-resource|Android developer guide: Menu resource}
  324. */
  325. showAsAction?: 'ifRoom' | 'withText' | 'always' | 'never';
  326. }
  327. export interface OptionsTopBar {
  328. /**
  329. * Show or hide the top bar
  330. */
  331. visible?: boolean;
  332. /**
  333. * Controls whether TopBar visibility changes should be animated
  334. */
  335. animate?: boolean;
  336. /**
  337. * Top bar will hide and show based on users scroll direction
  338. */
  339. hideOnScroll?: boolean;
  340. /**
  341. * Change button colors in the top bar
  342. */
  343. leftButtonColor?: Color;
  344. rightButtonColor?: Color;
  345. leftButtonDisabledColor?: Color;
  346. rightButtonDisabledColor?: Color;
  347. /**
  348. * Draw behind the navbar
  349. */
  350. drawBehind?: boolean;
  351. /**
  352. * Can be used to reference the top bar in E2E tests
  353. */
  354. testID?: string;
  355. /**
  356. * Title configuration
  357. */
  358. title?: OptionsTopBarTitle;
  359. /**
  360. * Subtitle configuration
  361. */
  362. subtitle?: OptionsTopBarSubtitle;
  363. /**
  364. * Back button configuration
  365. */
  366. backButton?: OptionsTopBarBackButton;
  367. /**
  368. * List of buttons to the left
  369. */
  370. leftButtons?: OptionsTopBarButton[];
  371. /**
  372. * List of buttons to the right
  373. */
  374. rightButtons?: OptionsTopBarButton[];
  375. /**
  376. * Background configuration
  377. */
  378. background?: OptionsTopBarBackground;
  379. /**
  380. * Control the NavBar blur style
  381. * #### (iOS specific)
  382. * @requires translucent: true
  383. * @default 'default'
  384. */
  385. barStyle?: 'default' | 'black';
  386. /**
  387. * Disable the border on bottom of the navbar
  388. * #### (iOS specific)
  389. * @default false
  390. */
  391. noBorder?: boolean;
  392. /**
  393. * Show a UISearchBar in the Top Bar
  394. * #### (iOS 11+ specific)
  395. */
  396. searchBar?: boolean;
  397. /**
  398. * Hides the UISearchBar when scrolling
  399. * #### (iOS 11+ specific)
  400. */
  401. searchBarHiddenWhenScrolling?: boolean;
  402. /**
  403. * The placeholder value in the UISearchBar
  404. * #### (iOS 11+ specific)
  405. */
  406. searchBarPlaceholder?: string;
  407. /**
  408. * Controls Hiding NavBar on focus UISearchBar
  409. * #### (iOS 11+ specific)
  410. */
  411. hideNavBarOnFocusSearchBar?: boolean;
  412. /**
  413. * Control the Large Title configuration
  414. * #### (iOS 11+ specific)
  415. */
  416. largeTitle?: OptionsTopBarLargeTitle;
  417. /**
  418. * Set the height of the navbar in dp
  419. * #### (Android specific)
  420. */
  421. height?: AndroidDensityNumber;
  422. /**
  423. * Change the navbar border color
  424. * #### (Android specific)
  425. */
  426. borderColor?: Color;
  427. /**
  428. * Set the border height of the navbar in dp
  429. * #### (Android specific)
  430. */
  431. borderHeight?: AndroidDensityNumber;
  432. /**
  433. * Set the elevation of the navbar in dp
  434. * #### (Android specific)
  435. */
  436. elevation?: AndroidDensityNumber;
  437. /**
  438. * Layout top margin
  439. * #### (Android specific)
  440. */
  441. topMargin?: number;
  442. }
  443. export interface OptionsFab {
  444. id: string;
  445. backgroundColor?: Color;
  446. clickColor?: Color;
  447. rippleColor?: Color;
  448. visible?: boolean;
  449. icon?: ImageRequireSource;
  450. iconColor?: Color;
  451. alignHorizontally?: 'left' | 'right';
  452. alignVertically?: 'top' | 'bottom';
  453. hideOnScroll?: boolean;
  454. size?: number;
  455. actions?: OptionsFab[];
  456. }
  457. export interface OptionsBottomTabs {
  458. /**
  459. * Show or hide the bottom tabs
  460. */
  461. visible?: boolean;
  462. /**
  463. * Enable animations when toggling visibility
  464. */
  465. animate?: boolean;
  466. /**
  467. * Switch to another screen within the bottom tabs via index (starting from 0)
  468. */
  469. currentTabIndex?: number;
  470. /**
  471. * Switch to another screen within the bottom tabs via screen name
  472. */
  473. currentTabId?: string;
  474. /**
  475. * Set a testID to reference the bottom tabs
  476. */
  477. testID?: string;
  478. /**
  479. * Draw screen component under the tab bar
  480. */
  481. drawBehind?: boolean;
  482. /**
  483. * Set a background color for the bottom tabs
  484. */
  485. backgroundColor?: Color;
  486. /**
  487. * Set when tabs are attached to hierarchy consequently when the
  488. * RootView's constructor is called.
  489. */
  490. tabsAttachMode?: 'together' | 'afterInitialTab' | 'onSwitchToTab';
  491. /**
  492. * Control the Bottom Tabs blur style
  493. * #### (iOS specific)
  494. * @requires translucent: true
  495. * @default 'default'
  496. */
  497. barStyle?: 'default' | 'black';
  498. /**
  499. * Allows the Bottom Tabs to be translucent (blurred)
  500. * #### (iOS specific)
  501. */
  502. translucent?: boolean;
  503. /**
  504. * Hide the top line of the Tab Bar
  505. * #### (iOS specific)
  506. */
  507. hideShadow?: boolean;
  508. /**
  509. * Control the text display mode below the tab icon
  510. * #### (Android specific)
  511. */
  512. titleDisplayMode?: 'alwaysShow' | 'showWhenActive' | 'alwaysHide';
  513. /**
  514. * Set the elevation of the Bottom Tabs in dp
  515. * #### (Android specific)
  516. */
  517. elevation?: AndroidDensityNumber;
  518. }
  519. export interface DotIndicatorOptions {
  520. // default red
  521. color?: Color;
  522. // default 6
  523. size?: number;
  524. // default false
  525. visible?: boolean;
  526. }
  527. export interface OptionsBottomTab {
  528. dotIndicator?: DotIndicatorOptions;
  529. /**
  530. * Set the text to display below the icon
  531. */
  532. text?: string;
  533. /**
  534. * Set the text in a badge that is overlayed over the component
  535. */
  536. badge?: string;
  537. /**
  538. * Set the background color of the badge that is overlayed over the component
  539. */
  540. badgeColor?: string;
  541. /**
  542. * Set a testID to reference the tab in E2E tests
  543. */
  544. testID?: string;
  545. /**
  546. * Set the tab icon
  547. */
  548. icon?: ImageRequireSource;
  549. /**
  550. * Set the icon tint
  551. */
  552. iconColor?: Color;
  553. /**
  554. * Set the text color
  555. */
  556. textColor?: Color;
  557. /**
  558. * Set the selected icon tint
  559. */
  560. selectedIconColor?: Color;
  561. /**
  562. * Set the selected text color
  563. */
  564. selectedTextColor?: Color;
  565. /**
  566. * Set the text font family
  567. */
  568. fontFamily?: FontFamily;
  569. /**
  570. * Set the font weight, ignore fontFamily and use the iOS system fonts instead
  571. * #### (iOS specific)
  572. */
  573. fontWeight?: FontWeight;
  574. /**
  575. * Set the text font size
  576. */
  577. fontSize?: number;
  578. /**
  579. * Set the insets of the icon
  580. * #### (iOS specific)
  581. */
  582. iconInsets?: Insets;
  583. /**
  584. * Set selected icon image
  585. * #### (iOS specific)
  586. */
  587. selectedIcon?: ImageRequireSource;
  588. /**
  589. * Set true if you want to disable the icon tinting
  590. * #### (iOS specific)
  591. */
  592. disableIconTint?: boolean;
  593. /**
  594. * Set true if you want to disable the text tinting
  595. * #### (iOS specific)
  596. */
  597. disableSelectedIconTint?: boolean;
  598. /**
  599. * Set the font size for selected tabs
  600. * #### (Android specific)
  601. */
  602. selectedFontSize?: number;
  603. }
  604. export interface SideMenuSide {
  605. /**
  606. * Show or hide the side menu
  607. */
  608. visible?: boolean;
  609. /**
  610. * Enable or disable the side menu
  611. */
  612. enabled?: boolean;
  613. /**
  614. * Set the width of the side menu
  615. */
  616. width?: number;
  617. /**
  618. * Set the height of the side menu
  619. */
  620. height?: number;
  621. }
  622. export interface OptionsSideMenu {
  623. /**
  624. * Configure the left side menu
  625. */
  626. left?: SideMenuSide;
  627. /**
  628. * Configure the right side menu
  629. */
  630. right?: SideMenuSide;
  631. /**
  632. * Configure how a user is allowed to open a drawer using gestures
  633. * #### (iOS specific)
  634. * @default 'entireScreen'
  635. */
  636. openGestureMode?: 'entireScreen' | 'bezel';
  637. }
  638. export interface OverlayOptions {
  639. /**
  640. * Capture touches outside of the Component View
  641. */
  642. interceptTouchOutside?: boolean;
  643. /**
  644. * Control wether this Overlay should handle Keyboard events.
  645. * Set this to true if your Overlay contains a TextInput.
  646. */
  647. handleKeyboardEvents?: boolean;
  648. }
  649. export interface OptionsPreviewAction {
  650. /**
  651. * Reference ID to get callbacks from
  652. */
  653. id: string;
  654. /**
  655. * Action text
  656. */
  657. title: string;
  658. /**
  659. * Action style
  660. */
  661. style?: 'default' | 'selected' | 'destructive';
  662. /**
  663. * Subactions that will be shown when this action is pressed.
  664. */
  665. actions?: OptionsPreviewAction[];
  666. }
  667. export interface OptionsPreview {
  668. /**
  669. * Pass a react node tag to mark a SourceRect for a specific
  670. * peek and pop preview element.
  671. */
  672. reactTag?: number;
  673. /**
  674. * You can set this property specify the width of the preview.
  675. * If the width is greater than the device width, it will be zoomed in.
  676. */
  677. width?: number;
  678. /**
  679. * Height of the preview
  680. */
  681. height?: 100;
  682. /**
  683. * You can control if the users gesture will result in pushing
  684. * the preview screen into the stack.
  685. */
  686. commit?: boolean;
  687. /**
  688. * List of actions that will appear underneath the preview window.
  689. * They can be nested for sub actions.
  690. */
  691. actions?: OptionsPreviewAction[];
  692. }
  693. export interface OptionsAnimationPropertyConfig {
  694. /**
  695. * Animate from this value, ex. 0
  696. */
  697. from?: number;
  698. /**
  699. * Animate to this value, ex. 1
  700. */
  701. to?: number;
  702. /**
  703. * Animation duration
  704. * @default 300
  705. */
  706. duration?: number;
  707. /**
  708. * Animation delay
  709. * @default 0
  710. */
  711. startDelay?: number;
  712. /**
  713. * Animation interplation
  714. */
  715. interpolation?: 'accelerate' | 'decelerate';
  716. }
  717. /**
  718. * Used to animate the actual content added to the hierarchy.
  719. * Content can be a React component (component) or any other layout (Stack, BottomTabs etc)
  720. */
  721. export interface ScreenAnimationOptions {
  722. /**
  723. * Animate the element over translateX
  724. */
  725. x?: OptionsAnimationPropertyConfig;
  726. /**
  727. * Animate the element over translateY
  728. */
  729. y?: OptionsAnimationPropertyConfig;
  730. /**
  731. * Animate the element over opacity
  732. */
  733. alpha?: OptionsAnimationPropertyConfig;
  734. /**
  735. * Animate the element over scaleX
  736. */
  737. scaleX?: OptionsAnimationPropertyConfig;
  738. /**
  739. * Animate the element over scaleY
  740. */
  741. scaleY?: OptionsAnimationPropertyConfig;
  742. /**
  743. * Animate the element over rotationX
  744. */
  745. rotationX?: OptionsAnimationPropertyConfig;
  746. /**
  747. * Animate the element over rotationY
  748. */
  749. rotationY?: OptionsAnimationPropertyConfig;
  750. /**
  751. * Animate the element over rotation
  752. */
  753. rotation?: OptionsAnimationPropertyConfig;
  754. /**
  755. * Wait for the root view to render before start animation
  756. */
  757. waitForRender?: boolean;
  758. /**
  759. * Enable or disable the animation
  760. * @default true
  761. */
  762. enabled?: boolean;
  763. }
  764. export interface IconInsets {
  765. /**
  766. * Configure top inset
  767. */
  768. top?: number;
  769. /**
  770. * Configure left inset
  771. */
  772. left?: number;
  773. /**
  774. * Configure bottom inset
  775. */
  776. bottom?: number;
  777. /**
  778. * Configure right inset
  779. */
  780. right?: number;
  781. }
  782. export interface ViewAnimationOptions extends ScreenAnimationOptions {
  783. /**
  784. * ID of the Top Bar we want to animate
  785. */
  786. id?: string;
  787. }
  788. /**
  789. * Used for describing stack commands animations.
  790. */
  791. export interface StackAnimationOptions {
  792. /**
  793. * Wait for the View to render before start animation
  794. */
  795. waitForRender?: boolean;
  796. /**
  797. * Enable or disable the animation
  798. * @default true
  799. */
  800. enabled?: boolean;
  801. /**
  802. * Configure animations for the top bar
  803. */
  804. topBar?: ViewAnimationOptions;
  805. /**
  806. * Configure animations for the bottom tabs
  807. */
  808. bottomTabs?: ViewAnimationOptions;
  809. /**
  810. * Configure animations for the content (Screen)
  811. */
  812. content?: ViewAnimationOptions;
  813. }
  814. /**
  815. * Used for configuring command animations
  816. */
  817. export interface AnimationOptions {
  818. /**
  819. * Configure the setRoot animation
  820. */
  821. setRoot?: ScreenAnimationOptions;
  822. /**
  823. * Configure what animates when a screen is pushed
  824. */
  825. push?: StackAnimationOptions;
  826. /**
  827. * Configure what animates when a screen is popped
  828. */
  829. pop?: StackAnimationOptions;
  830. /**
  831. * Configure what animates when modal is shown
  832. */
  833. showModal?: ScreenAnimationOptions;
  834. /**
  835. * Configure what animates when modal is dismissed
  836. */
  837. dismissModal?: ScreenAnimationOptions;
  838. }
  839. export interface OptionsCustomTransition {
  840. animations: OptionsCustomTransitionAnimation[];
  841. duration?: number;
  842. }
  843. export interface OptionsCustomTransitionAnimation {
  844. /**
  845. * Animation type, only support sharedElement currently
  846. */
  847. type: 'sharedElement';
  848. /**
  849. * Transition from element Id
  850. */
  851. fromId: string;
  852. /**
  853. * Transition to element Id
  854. */
  855. toId: string;
  856. /**
  857. * Animation delay
  858. */
  859. startDelay?: number;
  860. /**
  861. * Animation spring Velocity
  862. */
  863. springVelocity?: number;
  864. /**
  865. * Animation duration
  866. */
  867. duration?: number;
  868. }
  869. export interface Options {
  870. /**
  871. * Configure the status bar
  872. */
  873. statusBar?: OptionsStatusBar;
  874. /**
  875. * Configure the layout
  876. */
  877. layout?: OptionsLayout;
  878. /**
  879. * Configure the presentation style of the modal
  880. */
  881. modalPresentationStyle?: OptionsModalPresentationStyle;
  882. /**
  883. * Configure the transition style of the modal
  884. *
  885. * #### (Android specific)
  886. */
  887. modalTransitionStyle?: OptionsModalTransitionStyle;
  888. /**
  889. * Configure the top bar
  890. */
  891. topBar?: OptionsTopBar;
  892. fab?: OptionsFab;
  893. /**
  894. * Configure the bottom tabs
  895. */
  896. bottomTabs?: OptionsBottomTabs;
  897. /**
  898. * Configure the bottom tab associated to the screen
  899. */
  900. bottomTab?: OptionsBottomTab;
  901. /**
  902. * Configure the side menu
  903. */
  904. sideMenu?: OptionsSideMenu;
  905. /**
  906. * Configure the splitView controller
  907. */
  908. splitView?: OptionsSplitView;
  909. /**
  910. * Configure the overlay
  911. */
  912. overlay?: OverlayOptions;
  913. /**
  914. * Animation used for navigation commands that modify the layout
  915. * hierarchy can be controlled in options.
  916. *
  917. * Animations can be modified per command and it's also possible
  918. * to change the default animation for each command.
  919. *
  920. * Example:
  921. ```js
  922. setRoot: {
  923. y: {
  924. from: 1000,
  925. to: 0,
  926. duration: 500,
  927. interpolation: 'accelerate',
  928. },
  929. alpha: {
  930. from: 0,
  931. to: 1,
  932. duration: 400,
  933. startDelay: 100,
  934. interpolation: 'accelerate'
  935. }
  936. }
  937. ```
  938. */
  939. animations?: AnimationOptions;
  940. /**
  941. * Custom Transition used for animate shared element between two screens
  942. * Example:
  943. ```js
  944. Navigation.push(this.props.componentId, {
  945. component: {
  946. name: 'second.screen',
  947. options: {
  948. customTransition: {
  949. animations: [
  950. { type: 'sharedElement', fromId: 'image1', toId: 'image2', startDelay: 0, springVelocity: 0.2, duration: 0.5 }
  951. ],
  952. duration: 0.8
  953. }
  954. }
  955. }
  956. });
  957. ```
  958. */
  959. customTransition?: OptionsCustomTransition;
  960. /**
  961. * Preview configuration for Peek and Pop
  962. * #### (iOS specific)
  963. */
  964. preview?: OptionsPreview;
  965. /**
  966. * Enable or disable swipe back to pop gesture
  967. * #### (iOS specific)
  968. * @default true
  969. */
  970. popGesture?: boolean;
  971. /**
  972. * Background image for the screen
  973. * #### (iOS specific)
  974. */
  975. backgroundImage?: ImageRequireSource;
  976. /**
  977. * Background image for the Navigation View
  978. * #### (iOS specific)
  979. */
  980. rootBackgroundImage?: ImageRequireSource;
  981. /**
  982. * Enable or disable automatically blurring focused input, dismissing keyboard on unmount
  983. * #### (Android specific)
  984. * @default false
  985. */
  986. blurOnUnmount?: boolean;
  987. /**
  988. * Props to pass to a component
  989. */
  990. passProps?: Record<string, any>;
  991. }