RCTModalHostViewNativeComponent.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @format
  8. * @flow strict-local
  9. */
  10. 'use strict';
  11. import codegenNativeComponent from '../Utilities/codegenNativeComponent';
  12. import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
  13. import type {
  14. WithDefault,
  15. DirectEventHandler,
  16. Int32,
  17. } from '../Types/CodegenTypes';
  18. import type {ViewProps} from '../Components/View/ViewPropTypes';
  19. type OrientationChangeEvent = $ReadOnly<{|
  20. orientation: 'portrait' | 'landscape',
  21. |}>;
  22. type NativeProps = $ReadOnly<{|
  23. ...ViewProps,
  24. /**
  25. * The `animationType` prop controls how the modal animates.
  26. *
  27. * See https://reactnative.dev/docs/modal.html#animationtype
  28. */
  29. animationType?: WithDefault<'none' | 'slide' | 'fade', 'none'>,
  30. /**
  31. * The `presentationStyle` prop controls how the modal appears.
  32. *
  33. * See https://reactnative.dev/docs/modal.html#presentationstyle
  34. */
  35. presentationStyle?: WithDefault<
  36. 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen',
  37. 'fullScreen',
  38. >,
  39. /**
  40. * The `transparent` prop determines whether your modal will fill the
  41. * entire view.
  42. *
  43. * See https://reactnative.dev/docs/modal.html#transparent
  44. */
  45. transparent?: WithDefault<boolean, false>,
  46. /**
  47. * The `statusBarTranslucent` prop determines whether your modal should go under
  48. * the system statusbar.
  49. *
  50. * See https://reactnative.dev/docs/modal.html#statusBarTranslucent
  51. */
  52. statusBarTranslucent?: WithDefault<boolean, false>,
  53. /**
  54. * The `hardwareAccelerated` prop controls whether to force hardware
  55. * acceleration for the underlying window.
  56. *
  57. * See https://reactnative.dev/docs/modal.html#hardwareaccelerated
  58. */
  59. hardwareAccelerated?: WithDefault<boolean, false>,
  60. /**
  61. * The `onRequestClose` callback is called when the user taps the hardware
  62. * back button on Android or the menu button on Apple TV.
  63. *
  64. * This is required on Apple TV and Android.
  65. *
  66. * See https://reactnative.dev/docs/modal.html#onrequestclose
  67. */
  68. onRequestClose?: ?DirectEventHandler<null>,
  69. /**
  70. * The `onShow` prop allows passing a function that will be called once the
  71. * modal has been shown.
  72. *
  73. * See https://reactnative.dev/docs/modal.html#onshow
  74. */
  75. onShow?: ?DirectEventHandler<null>,
  76. /**
  77. * Deprecated. Use the `animationType` prop instead.
  78. */
  79. animated?: WithDefault<boolean, false>,
  80. /**
  81. * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations.
  82. *
  83. * See https://reactnative.dev/docs/modal.html#supportedorientations
  84. */
  85. supportedOrientations?: WithDefault<
  86. $ReadOnlyArray<
  87. | 'portrait'
  88. | 'portrait-upside-down'
  89. | 'landscape'
  90. | 'landscape-left'
  91. | 'landscape-right',
  92. >,
  93. 'portrait',
  94. >,
  95. /**
  96. * The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed.
  97. *
  98. * See https://reactnative.dev/docs/modal.html#onorientationchange
  99. */
  100. onOrientationChange?: ?DirectEventHandler<OrientationChangeEvent>,
  101. /**
  102. * The `identifier` is the unique number for identifying Modal components.
  103. */
  104. identifier?: WithDefault<Int32, 0>,
  105. |}>;
  106. export default (codegenNativeComponent<NativeProps>('ModalHostView', {
  107. interfaceOnly: true,
  108. paperComponentName: 'RCTModalHostView',
  109. }): HostComponent<NativeProps>);