@lodev09/react-native-true-sheet 3.11.10 → 4.0.0-beta.1

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 (73) hide show
  1. package/README.md +6 -5
  2. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerView.kt +23 -2
  3. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +116 -26
  4. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +7 -0
  5. package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +48 -0
  6. package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterViewManager.kt +7 -0
  7. package/android/src/main/java/com/lodev09/truesheet/TrueSheetStateUpdater.kt +45 -0
  8. package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +28 -12
  9. package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +99 -34
  10. package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +9 -5
  11. package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetCoordinatorLayout.kt +12 -3
  12. package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +33 -4
  13. package/android/src/main/jni/TrueSheetSpec.h +2 -0
  14. package/android/src/main/jni/TrueSheetStateUpdater.cpp +96 -0
  15. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewComponentDescriptor.h +24 -0
  16. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.cpp +43 -0
  17. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.h +28 -0
  18. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.cpp +11 -0
  19. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.h +37 -0
  20. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewComponentDescriptor.h +24 -0
  21. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.cpp +56 -0
  22. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.h +28 -0
  23. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.cpp +11 -0
  24. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.h +41 -0
  25. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.cpp +18 -0
  26. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.h +16 -0
  27. package/ios/TrueSheetContainerView.h +12 -10
  28. package/ios/TrueSheetContainerView.mm +11 -29
  29. package/ios/TrueSheetContentView.h +22 -7
  30. package/ios/TrueSheetContentView.mm +143 -41
  31. package/ios/TrueSheetFooterView.h +12 -2
  32. package/ios/TrueSheetFooterView.mm +74 -71
  33. package/ios/TrueSheetHeaderView.mm +0 -1
  34. package/ios/TrueSheetView.mm +60 -27
  35. package/ios/TrueSheetViewController.h +9 -0
  36. package/ios/TrueSheetViewController.mm +288 -122
  37. package/ios/core/TrueSheetDetentCalculator.h +9 -0
  38. package/ios/core/TrueSheetDetentCalculator.mm +13 -4
  39. package/ios/tvos/TrueSheetStubs.mm +2 -0
  40. package/lib/module/TrueSheet.js +32 -13
  41. package/lib/module/TrueSheet.js.map +1 -1
  42. package/lib/module/TrueSheet.web.js +262 -38
  43. package/lib/module/TrueSheet.web.js.map +1 -1
  44. package/lib/module/fabric/TrueSheetContentViewNativeComponent.ts +5 -1
  45. package/lib/module/fabric/TrueSheetFooterViewNativeComponent.ts +10 -2
  46. package/lib/module/fabric/TrueSheetViewNativeComponent.ts +8 -1
  47. package/lib/module/web/vaul/index.js +17 -6
  48. package/lib/module/web/vaul/index.js.map +1 -1
  49. package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
  50. package/lib/typescript/src/TrueSheet.types.d.ts +35 -11
  51. package/lib/typescript/src/TrueSheet.types.d.ts.map +1 -1
  52. package/lib/typescript/src/TrueSheet.web.d.ts.map +1 -1
  53. package/lib/typescript/src/fabric/TrueSheetContentViewNativeComponent.d.ts.map +1 -1
  54. package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts +2 -0
  55. package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts.map +1 -1
  56. package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts +5 -1
  57. package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts.map +1 -1
  58. package/lib/typescript/src/navigation/types.d.ts +1 -1
  59. package/lib/typescript/src/navigation/types.d.ts.map +1 -1
  60. package/lib/typescript/src/web/vaul/index.d.ts +8 -1
  61. package/lib/typescript/src/web/vaul/index.d.ts.map +1 -1
  62. package/package.json +10 -10
  63. package/react-native.config.js +5 -1
  64. package/src/TrueSheet.tsx +45 -14
  65. package/src/TrueSheet.types.ts +38 -12
  66. package/src/TrueSheet.web.tsx +314 -44
  67. package/src/fabric/TrueSheetContentViewNativeComponent.ts +5 -1
  68. package/src/fabric/TrueSheetFooterViewNativeComponent.ts +10 -2
  69. package/src/fabric/TrueSheetViewNativeComponent.ts +8 -1
  70. package/src/navigation/types.ts +3 -1
  71. package/src/web/vaul/index.tsx +23 -5
  72. package/ios/utils/LayoutUtil.h +0 -77
  73. package/ios/utils/LayoutUtil.mm +0 -106
@@ -1,77 +0,0 @@
1
- //
2
- // Created by Jovanni Lo (@lodev09)
3
- // Copyright (c) 2024-present. All rights reserved.
4
- //
5
- // This source code is licensed under the MIT license found in the
6
- // LICENSE file in the root directory of this source tree.
7
- //
8
-
9
- #ifdef RCT_NEW_ARCH_ENABLED
10
-
11
- #import <UIKit/UIKit.h>
12
-
13
- NS_ASSUME_NONNULL_BEGIN
14
-
15
- @interface LayoutUtil : NSObject
16
-
17
- /**
18
- * Pins a view to its parent view using Auto Layout constraints
19
- * @param view The view to pin
20
- * @param parentView The parent view to pin to
21
- * @param edges The edges to pin (UIRectEdge flags)
22
- */
23
- + (void)pinView:(UIView *)view toParentView:(UIView *)parentView edges:(UIRectEdge)edges;
24
-
25
- /**
26
- * Pins a view to its parent view with a specific height constraint
27
- * @param view The view to pin
28
- * @param parentView The parent view to pin to
29
- * @param edges The edges to pin (UIRectEdge flags)
30
- * @param height The height constraint to apply (0 means no height constraint)
31
- */
32
- + (void)pinView:(UIView *)view toParentView:(UIView *)parentView edges:(UIRectEdge)edges height:(CGFloat)height;
33
-
34
- /**
35
- * Pins a view to its parent view with its top edge anchored below a top sibling view
36
- * @param view The view to pin
37
- * @param parentView The parent view to pin to
38
- * @param topView The view to position below (top sibling)
39
- * @param edges The edges to pin to parent (excluding top, which is pinned to topView)
40
- */
41
- + (void)pinView:(UIView *)view toParentView:(UIView *)parentView withTopView:(UIView *)topView edges:(UIRectEdge)edges;
42
-
43
- /**
44
- * Pins a view to its parent view with insets
45
- * @param view The view to pin
46
- * @param parentView The parent view to pin to
47
- * @param edges The edges to pin (UIRectEdge flags)
48
- * @param insets The insets to apply to each edge
49
- */
50
- + (void)pinView:(UIView *)view toParentView:(UIView *)parentView edges:(UIRectEdge)edges insets:(UIEdgeInsets)insets;
51
-
52
- /**
53
- * Pins a view to its parent view with its top edge anchored below a top sibling view, with insets
54
- * @param view The view to pin
55
- * @param parentView The parent view to pin to
56
- * @param topView The view to position below (top sibling)
57
- * @param edges The edges to pin to parent (excluding top, which is pinned to topView)
58
- * @param insets The insets to apply to each edge
59
- */
60
- + (void)pinView:(UIView *)view
61
- toParentView:(UIView *)parentView
62
- withTopView:(UIView *)topView
63
- edges:(UIRectEdge)edges
64
- insets:(UIEdgeInsets)insets;
65
-
66
- /**
67
- * Unpins a view by removing its constraints and re-enabling autoresizing mask translation
68
- * @param view The view to unpin
69
- * @param parentView The parent view that holds the constraints (optional, will use superview if nil)
70
- */
71
- + (void)unpinView:(UIView *)view fromParentView:(nullable UIView *)parentView;
72
-
73
- @end
74
-
75
- NS_ASSUME_NONNULL_END
76
-
77
- #endif
@@ -1,106 +0,0 @@
1
- //
2
- // Created by Jovanni Lo (@lodev09)
3
- // Copyright (c) 2024-present. All rights reserved.
4
- //
5
- // This source code is licensed under the MIT license found in the
6
- // LICENSE file in the root directory of this source tree.
7
- //
8
-
9
- #ifdef RCT_NEW_ARCH_ENABLED
10
-
11
- #import "LayoutUtil.h"
12
-
13
- @implementation LayoutUtil
14
-
15
- + (void)pinView:(UIView *)view toParentView:(UIView *)parentView edges:(UIRectEdge)edges {
16
- [self pinView:view toParentView:parentView edges:edges height:0];
17
- }
18
-
19
- + (void)pinView:(UIView *)view toParentView:(UIView *)parentView edges:(UIRectEdge)edges height:(CGFloat)height {
20
- view.translatesAutoresizingMaskIntoConstraints = NO;
21
-
22
- if (edges & UIRectEdgeTop) {
23
- [view.topAnchor constraintEqualToAnchor:parentView.topAnchor].active = YES;
24
- }
25
- if (edges & UIRectEdgeBottom) {
26
- [view.bottomAnchor constraintEqualToAnchor:parentView.bottomAnchor].active = YES;
27
- }
28
- if (edges & UIRectEdgeLeft) {
29
- [view.leadingAnchor constraintEqualToAnchor:parentView.leadingAnchor].active = YES;
30
- }
31
- if (edges & UIRectEdgeRight) {
32
- [view.trailingAnchor constraintEqualToAnchor:parentView.trailingAnchor].active = YES;
33
- }
34
-
35
- // Apply height constraint if provided
36
- if (height > 0) {
37
- [view.heightAnchor constraintEqualToConstant:height].active = YES;
38
- }
39
- }
40
-
41
- + (void)pinView:(UIView *)view toParentView:(UIView *)parentView edges:(UIRectEdge)edges insets:(UIEdgeInsets)insets {
42
- view.translatesAutoresizingMaskIntoConstraints = NO;
43
-
44
- if (edges & UIRectEdgeTop) {
45
- [view.topAnchor constraintEqualToAnchor:parentView.topAnchor constant:insets.top].active = YES;
46
- }
47
- if (edges & UIRectEdgeBottom) {
48
- [view.bottomAnchor constraintEqualToAnchor:parentView.bottomAnchor constant:-insets.bottom].active = YES;
49
- }
50
- if (edges & UIRectEdgeLeft) {
51
- [view.leadingAnchor constraintEqualToAnchor:parentView.leadingAnchor constant:insets.left].active = YES;
52
- }
53
- if (edges & UIRectEdgeRight) {
54
- [view.trailingAnchor constraintEqualToAnchor:parentView.trailingAnchor constant:-insets.right].active = YES;
55
- }
56
- }
57
-
58
- + (void)pinView:(UIView *)view toParentView:(UIView *)parentView withTopView:(UIView *)topView edges:(UIRectEdge)edges {
59
- [self pinView:view toParentView:parentView withTopView:topView edges:edges insets:UIEdgeInsetsZero];
60
- }
61
-
62
- + (void)pinView:(UIView *)view
63
- toParentView:(UIView *)parentView
64
- withTopView:(UIView *)topView
65
- edges:(UIRectEdge)edges
66
- insets:(UIEdgeInsets)insets {
67
- view.translatesAutoresizingMaskIntoConstraints = NO;
68
-
69
- // Pin top edge to bottom of top sibling
70
- [view.topAnchor constraintEqualToAnchor:topView.bottomAnchor].active = YES;
71
-
72
- // Pin other edges to parent based on edges parameter
73
- if (edges & UIRectEdgeBottom) {
74
- [view.bottomAnchor constraintEqualToAnchor:parentView.bottomAnchor constant:-insets.bottom].active = YES;
75
- }
76
- if (edges & UIRectEdgeLeft) {
77
- [view.leadingAnchor constraintEqualToAnchor:parentView.leadingAnchor constant:insets.left].active = YES;
78
- }
79
- if (edges & UIRectEdgeRight) {
80
- [view.trailingAnchor constraintEqualToAnchor:parentView.trailingAnchor constant:-insets.right].active = YES;
81
- }
82
- }
83
-
84
- + (void)unpinView:(UIView *)view fromParentView:(UIView *)parentView {
85
- if (!view)
86
- return;
87
-
88
- // Remove constraints from parent view that reference this view
89
- UIView *targetParent = parentView ?: view.superview;
90
- if (targetParent) {
91
- NSMutableArray *constraintsToRemove = [NSMutableArray array];
92
- for (NSLayoutConstraint *constraint in targetParent.constraints) {
93
- if (constraint.firstItem == view || constraint.secondItem == view) {
94
- [constraintsToRemove addObject:constraint];
95
- }
96
- }
97
- [targetParent removeConstraints:constraintsToRemove];
98
- }
99
-
100
- view.translatesAutoresizingMaskIntoConstraints = YES;
101
- [view removeConstraints:view.constraints];
102
- }
103
-
104
- @end
105
-
106
- #endif