react-native-screens 4.0.0-beta.0 → 4.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +26 -6
  3. package/android/src/fabric/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt +4 -3
  4. package/android/src/main/java/com/swmansion/rnscreens/CustomToolbar.kt +40 -1
  5. package/android/src/main/java/com/swmansion/rnscreens/Screen.kt +18 -34
  6. package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +9 -3
  7. package/android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt +2 -1
  8. package/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt +1 -1
  9. package/android/src/main/java/com/swmansion/rnscreens/events/HeaderHeightChangeEvent.kt +3 -3
  10. package/android/src/main/res/base/anim/rns_ios_from_left_background_close.xml +5 -0
  11. package/android/src/main/res/base/anim/{rns_slide_out_to_left_ios.xml → rns_ios_from_left_background_open.xml} +1 -1
  12. package/android/src/main/res/base/anim/rns_ios_from_left_foreground_close.xml +6 -0
  13. package/android/src/main/res/base/anim/rns_ios_from_left_foreground_open.xml +6 -0
  14. package/android/src/main/res/base/anim/rns_ios_from_right_background_open.xml +5 -0
  15. package/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt +1 -1
  16. package/common/cpp/react/renderer/components/rnscreens/RNSScreenComponentDescriptor.h +5 -99
  17. package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.cpp +101 -0
  18. package/common/cpp/react/renderer/components/rnscreens/RNSScreenShadowNode.h +2 -0
  19. package/ios/RNSConvert.mm +4 -1
  20. package/ios/RNSFullWindowOverlay.mm +6 -0
  21. package/ios/RNSModalScreen.mm +7 -0
  22. package/ios/RNSScreen.mm +9 -0
  23. package/ios/RNSScreenContainer.mm +6 -0
  24. package/ios/RNSScreenContentWrapper.mm +6 -0
  25. package/ios/RNSScreenFooter.mm +6 -0
  26. package/ios/RNSScreenNavigationContainer.mm +7 -0
  27. package/ios/RNSScreenStack.mm +7 -7
  28. package/ios/RNSScreenStackHeaderConfig.mm +10 -0
  29. package/ios/RNSScreenStackHeaderSubview.mm +6 -3
  30. package/ios/RNSSearchBar.mm +7 -0
  31. package/lib/commonjs/TransitionProgressContext.js +1 -0
  32. package/lib/commonjs/TransitionProgressContext.js.map +1 -1
  33. package/lib/commonjs/components/Screen.js +58 -3
  34. package/lib/commonjs/components/Screen.js.map +1 -1
  35. package/lib/commonjs/components/Screen.web.js +2 -0
  36. package/lib/commonjs/components/Screen.web.js.map +1 -1
  37. package/lib/commonjs/components/ScreenContainer.js +1 -0
  38. package/lib/commonjs/components/ScreenContainer.js.map +1 -1
  39. package/lib/commonjs/components/ScreenContentWrapper.web.js +10 -0
  40. package/lib/commonjs/components/ScreenContentWrapper.web.js.map +1 -0
  41. package/lib/commonjs/components/ScreenStack.js +1 -0
  42. package/lib/commonjs/components/ScreenStack.js.map +1 -1
  43. package/lib/commonjs/components/ScreenStackHeaderConfig.js +1 -0
  44. package/lib/commonjs/components/ScreenStackHeaderConfig.js.map +1 -1
  45. package/lib/commonjs/components/SearchBar.js +1 -0
  46. package/lib/commonjs/components/SearchBar.js.map +1 -1
  47. package/lib/commonjs/core.js +1 -0
  48. package/lib/commonjs/core.js.map +1 -1
  49. package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js +1 -0
  50. package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
  51. package/lib/commonjs/fabric/ModalScreenNativeComponent.js +1 -0
  52. package/lib/commonjs/fabric/ModalScreenNativeComponent.js.map +1 -1
  53. package/lib/commonjs/fabric/NativeScreensModule.js +2 -1
  54. package/lib/commonjs/fabric/NativeScreensModule.js.map +1 -1
  55. package/lib/commonjs/fabric/ScreenContainerNativeComponent.js +1 -0
  56. package/lib/commonjs/fabric/ScreenContainerNativeComponent.js.map +1 -1
  57. package/lib/commonjs/fabric/ScreenNativeComponent.js +1 -0
  58. package/lib/commonjs/fabric/ScreenNativeComponent.js.map +1 -1
  59. package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js +1 -0
  60. package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
  61. package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js +1 -0
  62. package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
  63. package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js +1 -0
  64. package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
  65. package/lib/commonjs/fabric/ScreenStackNativeComponent.js +1 -0
  66. package/lib/commonjs/fabric/ScreenStackNativeComponent.js.map +1 -1
  67. package/lib/commonjs/fabric/SearchBarNativeComponent.js +2 -2
  68. package/lib/commonjs/fabric/SearchBarNativeComponent.js.map +1 -1
  69. package/lib/commonjs/native-stack/contexts/GHContext.js +1 -0
  70. package/lib/commonjs/native-stack/contexts/GHContext.js.map +1 -1
  71. package/lib/commonjs/native-stack/views/NativeStackView.js +4 -4
  72. package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
  73. package/lib/module/TransitionProgressContext.js +2 -0
  74. package/lib/module/TransitionProgressContext.js.map +1 -1
  75. package/lib/module/components/Screen.js +59 -3
  76. package/lib/module/components/Screen.js.map +1 -1
  77. package/lib/module/components/Screen.web.js +3 -0
  78. package/lib/module/components/Screen.web.js.map +1 -1
  79. package/lib/module/components/ScreenContainer.js +2 -0
  80. package/lib/module/components/ScreenContainer.js.map +1 -1
  81. package/lib/module/components/ScreenContentWrapper.web.js +4 -0
  82. package/lib/module/components/ScreenContentWrapper.web.js.map +1 -0
  83. package/lib/module/components/ScreenStack.js +2 -0
  84. package/lib/module/components/ScreenStack.js.map +1 -1
  85. package/lib/module/components/ScreenStackHeaderConfig.js +2 -0
  86. package/lib/module/components/ScreenStackHeaderConfig.js.map +1 -1
  87. package/lib/module/components/SearchBar.js +2 -0
  88. package/lib/module/components/SearchBar.js.map +1 -1
  89. package/lib/module/core.js +2 -0
  90. package/lib/module/core.js.map +1 -1
  91. package/lib/module/fabric/FullWindowOverlayNativeComponent.js +2 -0
  92. package/lib/module/fabric/FullWindowOverlayNativeComponent.js.map +1 -1
  93. package/lib/module/fabric/ModalScreenNativeComponent.js +2 -0
  94. package/lib/module/fabric/ModalScreenNativeComponent.js.map +1 -1
  95. package/lib/module/fabric/NativeScreensModule.js +2 -1
  96. package/lib/module/fabric/NativeScreensModule.js.map +1 -1
  97. package/lib/module/fabric/ScreenContainerNativeComponent.js +2 -0
  98. package/lib/module/fabric/ScreenContainerNativeComponent.js.map +1 -1
  99. package/lib/module/fabric/ScreenNativeComponent.js +2 -0
  100. package/lib/module/fabric/ScreenNativeComponent.js.map +1 -1
  101. package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js +2 -0
  102. package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js.map +1 -1
  103. package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js +2 -0
  104. package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
  105. package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js +2 -0
  106. package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js.map +1 -1
  107. package/lib/module/fabric/ScreenStackNativeComponent.js +2 -0
  108. package/lib/module/fabric/ScreenStackNativeComponent.js.map +1 -1
  109. package/lib/module/fabric/SearchBarNativeComponent.js +2 -0
  110. package/lib/module/fabric/SearchBarNativeComponent.js.map +1 -1
  111. package/lib/module/index.js +6 -6
  112. package/lib/module/native-stack/contexts/GHContext.js +2 -0
  113. package/lib/module/native-stack/contexts/GHContext.js.map +1 -1
  114. package/lib/module/native-stack/views/NativeStackView.js +4 -4
  115. package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
  116. package/lib/typescript/TransitionProgressContext.d.ts.map +1 -1
  117. package/lib/typescript/components/Screen.d.ts.map +1 -1
  118. package/lib/typescript/components/Screen.web.d.ts.map +1 -1
  119. package/lib/typescript/components/ScreenContainer.d.ts.map +1 -1
  120. package/lib/typescript/components/ScreenContentWrapper.web.d.ts +4 -0
  121. package/lib/typescript/components/ScreenContentWrapper.web.d.ts.map +1 -0
  122. package/lib/typescript/components/ScreenStack.d.ts.map +1 -1
  123. package/lib/typescript/components/ScreenStackHeaderConfig.d.ts.map +1 -1
  124. package/lib/typescript/components/SearchBar.d.ts.map +1 -1
  125. package/lib/typescript/core.d.ts.map +1 -1
  126. package/lib/typescript/fabric/FullWindowOverlayNativeComponent.d.ts.map +1 -1
  127. package/lib/typescript/fabric/ModalScreenNativeComponent.d.ts.map +1 -1
  128. package/lib/typescript/fabric/NativeScreensModule.d.ts.map +1 -1
  129. package/lib/typescript/fabric/ScreenContainerNativeComponent.d.ts.map +1 -1
  130. package/lib/typescript/fabric/ScreenNativeComponent.d.ts +1 -1
  131. package/lib/typescript/fabric/ScreenNativeComponent.d.ts.map +1 -1
  132. package/lib/typescript/fabric/ScreenNavigationContainerNativeComponent.d.ts.map +1 -1
  133. package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts.map +1 -1
  134. package/lib/typescript/fabric/ScreenStackHeaderSubviewNativeComponent.d.ts.map +1 -1
  135. package/lib/typescript/fabric/ScreenStackNativeComponent.d.ts.map +1 -1
  136. package/lib/typescript/fabric/SearchBarNativeComponent.d.ts.map +1 -1
  137. package/lib/typescript/index.d.ts +18 -0
  138. package/lib/typescript/index.d.ts.map +1 -1
  139. package/lib/typescript/native-stack/contexts/GHContext.d.ts.map +1 -1
  140. package/lib/typescript/native-stack/types.d.ts +13 -3
  141. package/lib/typescript/native-stack/types.d.ts.map +1 -1
  142. package/lib/typescript/native-stack/views/NativeStackView.d.ts.map +1 -1
  143. package/lib/typescript/types.d.ts +34 -6
  144. package/lib/typescript/types.d.ts.map +1 -1
  145. package/native-stack/README.md +28 -4
  146. package/package.json +1 -1
  147. package/src/TransitionProgressContext.tsx +2 -0
  148. package/src/components/Screen.tsx +71 -3
  149. package/src/components/Screen.web.tsx +3 -0
  150. package/src/components/ScreenContainer.tsx +2 -0
  151. package/src/components/ScreenContentWrapper.web.tsx +4 -0
  152. package/src/components/ScreenStack.tsx +2 -0
  153. package/src/components/ScreenStackHeaderConfig.tsx +2 -0
  154. package/src/components/SearchBar.tsx +2 -0
  155. package/src/core.ts +2 -0
  156. package/src/fabric/FullWindowOverlayNativeComponent.ts +2 -0
  157. package/src/fabric/ModalScreenNativeComponent.ts +2 -0
  158. package/src/fabric/NativeScreensModule.ts +2 -0
  159. package/src/fabric/ScreenContainerNativeComponent.ts +2 -0
  160. package/src/fabric/ScreenNativeComponent.ts +5 -1
  161. package/src/fabric/ScreenNavigationContainerNativeComponent.ts +2 -0
  162. package/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +2 -0
  163. package/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts +2 -0
  164. package/src/fabric/ScreenStackNativeComponent.ts +2 -0
  165. package/src/fabric/SearchBarNativeComponent.ts +2 -0
  166. package/src/index.tsx +6 -6
  167. package/src/native-stack/contexts/GHContext.tsx +2 -0
  168. package/src/native-stack/types.tsx +13 -3
  169. package/src/native-stack/views/NativeStackView.tsx +8 -7
  170. package/src/types.tsx +42 -6
  171. package/windows/RNScreens/Screen.h +3 -1
  172. /package/android/src/main/res/base/anim/{rns_slide_in_from_left_ios.xml → rns_ios_from_right_background_close.xml} +0 -0
  173. /package/android/src/main/res/base/anim/{rns_slide_out_to_right_ios.xml → rns_ios_from_right_foreground_close.xml} +0 -0
  174. /package/android/src/main/res/base/anim/{rns_slide_in_from_right_ios.xml → rns_ios_from_right_foreground_open.xml} +0 -0
package/src/types.tsx CHANGED
@@ -39,7 +39,9 @@ export type StackAnimationTypes =
39
39
  | 'slide_from_bottom'
40
40
  | 'slide_from_right'
41
41
  | 'slide_from_left'
42
- | 'ios';
42
+ | 'ios'
43
+ | 'ios_from_right'
44
+ | 'ios_from_left';
43
45
  export type BlurEffectTypes =
44
46
  | 'extraLight'
45
47
  | 'light'
@@ -102,7 +104,6 @@ export interface ScreenProps extends ViewProps {
102
104
  active?: 0 | 1 | Animated.AnimatedInterpolation<number>;
103
105
  activityState?: 0 | 1 | 2 | Animated.AnimatedInterpolation<number>;
104
106
  children?: React.ReactNode;
105
- unstable_footer?: React.ReactNode;
106
107
  /**
107
108
  * Boolean indicating that swipe dismissal should trigger animation provided by `stackAnimation`. Defaults to `false`.
108
109
  *
@@ -297,9 +298,15 @@ export interface ScreenProps extends ViewProps {
297
298
  *
298
299
  * Please note that the array **must** be sorted in ascending order.
299
300
  *
301
+ * There are also legacy & **deprecated** options available:
302
+ *
303
+ * * 'medium' - corresponds to `[0.5]` detent value, around half of the screen height,
304
+ * * 'large' - corresponds to `[1.0]` detent value, maximum height,
305
+ * * 'all' - corresponds to `[0.5, 1.0]` value, the name is deceiving due to compatibility reasons.
306
+ *
300
307
  * Defaults to `[1.0]` literal.
301
308
  */
302
- sheetAllowedDetents?: number[];
309
+ sheetAllowedDetents?: number[] | 'fitToContents' | 'medium' | 'large' | 'all';
303
310
  /**
304
311
  * Integer value describing elevation of the sheet, impacting shadow on the top edge of the sheet.
305
312
  *
@@ -344,9 +351,23 @@ export interface ScreenProps extends ViewProps {
344
351
  * This prop can be set to an number, which indicates index of detent in `sheetAllowedDetents` array for which
345
352
  * there won't be a dimming view beneath the sheet.
346
353
  *
347
- * Defaults to `-1`, indicating that the dimming view should be always present.
354
+ * Additionaly there are following options available:
355
+ *
356
+ * * `none` - there will be dimming view for all detents levels,
357
+ * * `largest` - there won't be a dimming view for any detent level.
358
+ *
359
+ * There also legacy & **deprecated** prop values available: `medium`, `large` (don't confuse with `largest`), `all`, which work in tandem with
360
+ * corresponding legacy prop values for `sheetAllowedDetents` prop.
361
+ *
362
+ * Defaults to `none`, indicating that the dimming view should be always present.
348
363
  */
349
- sheetLargestUndimmedDetent?: number;
364
+ sheetLargestUndimmedDetent?:
365
+ | number
366
+ | 'none'
367
+ | 'largest'
368
+ | 'medium'
369
+ | 'large'
370
+ | 'all';
350
371
  /**
351
372
  * Index of the detent the sheet should expand to after being opened.
352
373
  * Works only when `stackPresentation` is set to `formSheet`.
@@ -365,7 +386,9 @@ export interface ScreenProps extends ViewProps {
365
386
  * - `slide_from_bottom` – performs a slide from bottom animation
366
387
  * - "slide_from_right" - slide in the new screen from right to left (Android only, resolves to default transition on iOS)
367
388
  * - "slide_from_left" - slide in the new screen from left to right
368
- * - "ios" - iOS like slide in animation (Android only, resolves to default transition on iOS)
389
+ * - "ios" - @deprecated iOS like slide in animation. pushes in the new screen from right to left (Android only, resolves to default transition on iOS) (will be removed in v4.0.0 in favor of `ios_from_right`)
390
+ * - "ios_from_right" - iOS like slide in animation. pushes in the new screen from right to left (Android only, resolves to default transition on iOS)
391
+ * - "ios_from_left" - iOS like slide in animation. pushes in the new screen from left to right (Android only, resolves to default transition on iOS)
369
392
  * - "none" – the screen appears/dissapears without an animation
370
393
  */
371
394
  stackAnimation?: StackAnimationTypes;
@@ -422,6 +445,19 @@ export interface ScreenProps extends ViewProps {
422
445
  * @platform ios
423
446
  */
424
447
  transitionDuration?: number;
448
+ /**
449
+ * Footer component that can be used alongside formSheet stack presentation style.
450
+ *
451
+ * This option is provided, because due to implementation details it might be problematic
452
+ * to implement such layout with JS-only code.
453
+ *
454
+ * Please note that this prop is marked as unstable and might be subject of breaking changes,
455
+ * including removal, in particular when we find solution that will make implementing it with JS
456
+ * straightforward.
457
+ *
458
+ * @platform android
459
+ */
460
+ unstable_sheetFooter?: () => React.ReactNode;
425
461
  }
426
462
 
427
463
  export interface ScreenContainerProps extends ViewProps {
@@ -11,7 +11,9 @@ enum class StackAnimation {
11
11
  SIMPLE_FROM_BOTTOM,
12
12
  SLIDE_FROM_RIGHT,
13
13
  SLIDE_FROM_LEFT,
14
- IOS
14
+ IOS,
15
+ IOS_FROM_RIGHT,
16
+ IOS_FROM_LEFT
15
17
  };
16
18
 
17
19
  enum class ReplaceAnimation { PUSH, POP };