@lodev09/react-native-true-sheet 4.0.0-beta.3 → 4.0.0-beta.30
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.
- package/README.md +28 -5
- package/android/build.gradle +23 -1
- package/android/proguard-rules.pro +3 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerView.kt +50 -16
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +303 -184
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +5 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +38 -109
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetModule.kt +13 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayView.kt +127 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayViewManager.kt +45 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPackage.kt +2 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetStateUpdater.kt +29 -3
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +234 -66
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +491 -186
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +64 -10
- package/android/src/main/java/com/lodev09/truesheet/core/RNScreensEventObserver.kt +31 -14
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBottomSheetBehavior.kt +135 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBottomSheetView.kt +23 -23
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetCoordinatorLayout.kt +130 -6
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +104 -39
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDimView.kt +14 -17
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetGrabberView.kt +2 -4
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetOverlayRootView.kt +148 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetStackManager.kt +33 -40
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetLifecycleEvents.kt +15 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/ColorUtils.kt +19 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/KeyboardUtils.kt +15 -2
- package/android/src/main/java/com/lodev09/truesheet/utils/ScreenUtils.kt +0 -12
- package/android/src/main/java/com/lodev09/truesheet/utils/ViewUtils.kt +19 -7
- package/android/src/main/jni/TrueSheetSpec.h +1 -0
- package/android/src/main/jni/TrueSheetStateUpdater.cpp +37 -6
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewComponentDescriptor.h +1 -9
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.cpp +114 -30
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.h +30 -7
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.cpp +2 -2
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.h +9 -8
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewComponentDescriptor.h +3 -5
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.cpp +14 -3
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.h +5 -6
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.cpp +1 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.h +10 -6
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.cpp +1 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.h +1 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetLayoutUtils.h +43 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewComponentDescriptor.h +21 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.cpp +17 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.h +33 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewComponentDescriptor.h +3 -5
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.cpp +7 -40
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.h +3 -7
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewState.cpp +3 -5
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewState.h +4 -5
- package/ios/TrueSheetContainerView.h +23 -7
- package/ios/TrueSheetContainerView.mm +45 -25
- package/ios/TrueSheetContentView.h +44 -15
- package/ios/TrueSheetContentView.mm +221 -190
- package/ios/TrueSheetFooterView.mm +133 -28
- package/ios/TrueSheetModule.h +2 -7
- package/ios/TrueSheetModule.mm +18 -18
- package/ios/TrueSheetOverlayView.h +42 -0
- package/ios/TrueSheetOverlayView.mm +175 -0
- package/ios/TrueSheetView.h +2 -0
- package/ios/TrueSheetView.mm +268 -52
- package/ios/TrueSheetViewController.h +36 -3
- package/ios/TrueSheetViewController.mm +797 -102
- package/ios/core/RNScreensEventObserver.mm +31 -28
- package/ios/core/TrueSheetBlurView.h +0 -2
- package/ios/core/TrueSheetBlurView.mm +3 -36
- package/ios/core/TrueSheetDetentCalculator.h +18 -1
- package/ios/core/TrueSheetDetentCalculator.mm +44 -9
- package/ios/core/TrueSheetDimView.h +27 -0
- package/ios/core/TrueSheetDimView.mm +41 -0
- package/ios/core/TrueSheetGrabberView.mm +13 -3
- package/ios/core/TrueSheetKeyboardObserver.h +7 -0
- package/ios/core/TrueSheetKeyboardObserver.mm +107 -15
- package/ios/core/TrueSheetOverlayContainerView.h +31 -0
- package/ios/core/TrueSheetOverlayContainerView.mm +35 -0
- package/ios/events/TrueSheetLifecycleEvents.h +2 -0
- package/ios/events/TrueSheetLifecycleEvents.mm +8 -0
- package/ios/tvos/TrueSheetStubs.mm +12 -0
- package/ios/utils/UIView+ScrollEdgeInteraction.h +1 -0
- package/ios/utils/UIView+ScrollEdgeInteraction.mm +24 -2
- package/lib/module/TrueSheet.js +222 -54
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.web.js +364 -275
- package/lib/module/TrueSheet.web.js.map +1 -1
- package/lib/module/TrueSheetBackground.js +15 -0
- package/lib/module/TrueSheetBackground.js.map +1 -0
- package/lib/module/TrueSheetOverlay.js +30 -0
- package/lib/module/TrueSheetOverlay.js.map +1 -0
- package/lib/module/TrueSheetOverlay.web.js +35 -0
- package/lib/module/TrueSheetOverlay.web.js.map +1 -0
- package/lib/module/TrueSheetPeek.web.js +20 -15
- package/lib/module/TrueSheetPeek.web.js.map +1 -1
- package/lib/module/TrueSheetProvider.web.js +13 -9
- package/lib/module/TrueSheetProvider.web.js.map +1 -1
- package/lib/module/detentBackgrounds.js +21 -0
- package/lib/module/detentBackgrounds.js.map +1 -0
- package/lib/module/fabric/TrueSheetContentViewNativeComponent.ts +1 -1
- package/lib/module/fabric/TrueSheetFooterViewNativeComponent.ts +2 -3
- package/lib/module/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/lib/module/fabric/TrueSheetViewNativeComponent.ts +89 -73
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks/index.js +18 -2
- package/lib/module/mocks/index.js.map +1 -1
- package/lib/module/mocks/navigationExpoRouter.js.map +1 -1
- package/lib/module/navigation/base-types.js +2 -0
- package/lib/module/navigation/base-types.js.map +1 -0
- package/lib/module/navigation/createTrueSheetRouter.js +158 -100
- package/lib/module/navigation/createTrueSheetRouter.js.map +1 -1
- package/lib/module/navigation/expo-router/base-types.js +2 -0
- package/lib/module/navigation/expo-router/base-types.js.map +1 -0
- package/lib/module/navigation/expo-router/extendTrueSheetRouter.js +71 -0
- package/lib/module/navigation/expo-router/extendTrueSheetRouter.js.map +1 -0
- package/lib/module/navigation/expo-router/index.js +18 -7
- package/lib/module/navigation/expo-router/index.js.map +1 -1
- package/lib/module/navigation/expo-router/types.js +4 -0
- package/lib/module/navigation/expo-router/types.js.map +1 -0
- package/lib/module/navigation/index.js.map +1 -1
- package/lib/module/navigation/screen/useSheetScreenState.js +1 -0
- package/lib/module/navigation/screen/useSheetScreenState.js.map +1 -1
- package/lib/module/scrollable.js +28 -0
- package/lib/module/scrollable.js.map +1 -0
- package/lib/module/web/constants.js +1 -1
- package/lib/module/web/constants.js.map +1 -1
- package/lib/module/web/keyboard.js +69 -0
- package/lib/module/web/keyboard.js.map +1 -0
- package/lib/module/web/layout.js +168 -0
- package/lib/module/web/layout.js.map +1 -0
- package/lib/module/web/vaul/constants.js +9 -0
- package/lib/module/web/vaul/constants.js.map +1 -1
- package/lib/module/web/vaul/context.js +4 -0
- package/lib/module/web/vaul/context.js.map +1 -1
- package/lib/module/web/vaul/helpers.js +1 -0
- package/lib/module/web/vaul/helpers.js.map +1 -1
- package/lib/module/web/vaul/index.js +83 -21
- package/lib/module/web/vaul/index.js.map +1 -1
- package/lib/module/web/vaul/use-snap-points.js +57 -28
- package/lib/module/web/vaul/use-snap-points.js.map +1 -1
- package/lib/typescript/src/TrueSheet.d.ts +18 -1
- package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.types.d.ts +209 -35
- package/lib/typescript/src/TrueSheet.types.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.web.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheetBackground.d.ts +3 -0
- package/lib/typescript/src/TrueSheetBackground.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetOverlay.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetPeek.web.d.ts +8 -4
- package/lib/typescript/src/TrueSheetPeek.web.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheetProvider.web.d.ts +5 -1
- package/lib/typescript/src/TrueSheetProvider.web.d.ts.map +1 -1
- package/lib/typescript/src/detentBackgrounds.d.ts +10 -0
- package/lib/typescript/src/detentBackgrounds.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts +2 -3
- package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts +6 -0
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts +76 -65
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mocks/index.d.ts +4 -0
- package/lib/typescript/src/mocks/index.d.ts.map +1 -1
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts +3 -3
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts.map +1 -1
- package/lib/typescript/src/navigation/base-types.d.ts +9 -0
- package/lib/typescript/src/navigation/base-types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts +36 -10
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts.map +1 -1
- package/lib/typescript/src/navigation/expo-router/base-types.d.ts +8 -0
- package/lib/typescript/src/navigation/expo-router/base-types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/extendTrueSheetRouter.d.ts +33 -0
- package/lib/typescript/src/navigation/expo-router/extendTrueSheetRouter.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/index.d.ts +9 -6
- package/lib/typescript/src/navigation/expo-router/index.d.ts.map +1 -1
- package/lib/typescript/src/navigation/expo-router/types.d.ts +44 -0
- package/lib/typescript/src/navigation/expo-router/types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/index.d.ts +3 -4
- package/lib/typescript/src/navigation/index.d.ts.map +1 -1
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts +2 -1
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts.map +1 -1
- package/lib/typescript/src/navigation/types.d.ts +43 -6
- package/lib/typescript/src/navigation/types.d.ts.map +1 -1
- package/lib/typescript/src/scrollable.d.ts +2 -0
- package/lib/typescript/src/scrollable.d.ts.map +1 -0
- package/lib/typescript/src/web/constants.d.ts +1 -1
- package/lib/typescript/src/web/constants.d.ts.map +1 -1
- package/lib/typescript/src/web/keyboard.d.ts +15 -0
- package/lib/typescript/src/web/keyboard.d.ts.map +1 -0
- package/lib/typescript/src/web/layout.d.ts +20 -0
- package/lib/typescript/src/web/layout.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/constants.d.ts +3 -0
- package/lib/typescript/src/web/vaul/constants.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/context.d.ts +5 -1
- package/lib/typescript/src/web/vaul/context.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/helpers.d.ts +1 -0
- package/lib/typescript/src/web/vaul/helpers.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/index.d.ts +20 -1
- package/lib/typescript/src/web/vaul/index.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/types.d.ts +9 -0
- package/lib/typescript/src/web/vaul/types.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/use-snap-points.d.ts +6 -4
- package/lib/typescript/src/web/vaul/use-snap-points.d.ts.map +1 -1
- package/package.json +18 -8
- package/react-native.config.js +1 -0
- package/src/TrueSheet.tsx +257 -62
- package/src/TrueSheet.types.ts +225 -35
- package/src/TrueSheet.web.tsx +445 -333
- package/src/TrueSheetBackground.tsx +17 -0
- package/src/TrueSheetOverlay.tsx +24 -0
- package/src/TrueSheetOverlay.web.tsx +33 -0
- package/src/TrueSheetPeek.web.tsx +25 -23
- package/src/TrueSheetProvider.web.tsx +22 -13
- package/src/detentBackgrounds.ts +24 -0
- package/src/fabric/TrueSheetContentViewNativeComponent.ts +1 -1
- package/src/fabric/TrueSheetFooterViewNativeComponent.ts +2 -3
- package/src/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/src/fabric/TrueSheetViewNativeComponent.ts +89 -73
- package/src/index.ts +1 -0
- package/src/mocks/index.ts +17 -2
- package/src/mocks/navigationExpoRouter.ts +6 -5
- package/src/navigation/base-types.ts +20 -0
- package/src/navigation/createTrueSheetRouter.ts +220 -144
- package/src/navigation/expo-router/base-types.ts +18 -0
- package/src/navigation/expo-router/extendTrueSheetRouter.ts +99 -0
- package/src/navigation/expo-router/index.ts +41 -30
- package/src/navigation/expo-router/types.ts +116 -0
- package/src/navigation/index.ts +6 -7
- package/src/navigation/screen/useSheetScreenState.ts +2 -0
- package/src/navigation/types.ts +81 -23
- package/src/scrollable.ts +25 -0
- package/src/web/constants.ts +1 -1
- package/src/web/keyboard.ts +79 -0
- package/src/web/layout.ts +196 -0
- package/src/web/vaul/constants.ts +9 -0
- package/src/web/vaul/context.ts +7 -1
- package/src/web/vaul/helpers.ts +5 -0
- package/src/web/vaul/index.tsx +113 -16
- package/src/web/vaul/types.ts +10 -0
- package/src/web/vaul/use-snap-points.ts +86 -33
|
@@ -23,11 +23,10 @@ class TrueSheetViewState final {
|
|
|
23
23
|
TrueSheetViewState() = default;
|
|
24
24
|
|
|
25
25
|
#ifdef ANDROID
|
|
26
|
-
TrueSheetViewState(
|
|
27
|
-
TrueSheetViewState const &previousState,
|
|
28
|
-
folly::dynamic data)
|
|
26
|
+
TrueSheetViewState(TrueSheetViewState const &previousState, folly::dynamic data)
|
|
29
27
|
: containerWidth(static_cast<float>(data["containerWidth"].getDouble())),
|
|
30
|
-
containerHeight(static_cast<float>(data["containerHeight"].getDouble())) {
|
|
28
|
+
containerHeight(static_cast<float>(data["containerHeight"].getDouble())) {
|
|
29
|
+
}
|
|
31
30
|
#endif
|
|
32
31
|
|
|
33
32
|
float containerWidth{0};
|
|
@@ -49,4 +48,4 @@ class TrueSheetViewState final {
|
|
|
49
48
|
#endif
|
|
50
49
|
};
|
|
51
50
|
|
|
52
|
-
}
|
|
51
|
+
} // namespace facebook::react
|
|
@@ -16,11 +16,19 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
16
16
|
|
|
17
17
|
@interface ScrollableOptions : NSObject
|
|
18
18
|
|
|
19
|
+
@property (nonatomic, assign) facebook::react::TrueSheetViewContentInsetAdjustment contentInsetAdjustment;
|
|
19
20
|
@property (nonatomic, assign) CGFloat keyboardScrollOffset;
|
|
21
|
+
@property (nonatomic, assign) CGFloat keyboardOffset;
|
|
20
22
|
@property (nonatomic, assign) BOOL scrollingExpandsSheet;
|
|
21
23
|
@property (nonatomic, assign) facebook::react::TrueSheetViewTopScrollEdgeEffect topScrollEdgeEffect;
|
|
22
24
|
@property (nonatomic, assign) facebook::react::TrueSheetViewBottomScrollEdgeEffect bottomScrollEdgeEffect;
|
|
23
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Derived from `contentInsetAdjustment` — which of the two bottom insets apply
|
|
28
|
+
*/
|
|
29
|
+
@property (nonatomic, readonly) BOOL safeAreaInsetAdjustment;
|
|
30
|
+
@property (nonatomic, readonly) BOOL footerInsetAdjustment;
|
|
31
|
+
|
|
24
32
|
@end
|
|
25
33
|
|
|
26
34
|
@class TrueSheetPeekView;
|
|
@@ -29,6 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
29
37
|
|
|
30
38
|
- (void)containerViewContentDidChangeSize:(CGSize)newSize;
|
|
31
39
|
- (void)containerViewScrollViewDidChange;
|
|
40
|
+
- (void)containerViewDidMountTransaction;
|
|
32
41
|
|
|
33
42
|
@optional
|
|
34
43
|
|
|
@@ -46,20 +55,27 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
46
55
|
@property (nonatomic, weak, nullable) id<TrueSheetContainerViewDelegate> delegate;
|
|
47
56
|
|
|
48
57
|
/**
|
|
49
|
-
*
|
|
58
|
+
* Options for scrollable behavior
|
|
59
|
+
*/
|
|
60
|
+
@property (nonatomic, strong, nullable) ScrollableOptions *scrollableOptions;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* React tag of the user-provided scrollable within the content (see the `scrollableRef` prop)
|
|
50
64
|
*/
|
|
51
|
-
@property (nonatomic, assign)
|
|
65
|
+
@property (nonatomic, assign) NSInteger scrollableHandle;
|
|
52
66
|
|
|
53
67
|
/**
|
|
54
|
-
*
|
|
68
|
+
* Whether the resolved scrollable gets the bottom safe-area inset (UIKit's
|
|
69
|
+
* `contentInsetAdjustmentBehavior` set to `automatic`) — already gated by the
|
|
70
|
+
* sheet's `insetAdjustment`
|
|
55
71
|
*/
|
|
56
|
-
@property (nonatomic,
|
|
72
|
+
@property (nonatomic, assign) BOOL safeAreaInsetAdjustment;
|
|
57
73
|
|
|
58
74
|
/**
|
|
59
|
-
* Whether the
|
|
60
|
-
*
|
|
75
|
+
* Whether the resolved scrollable is padded by the absolute footer's height —
|
|
76
|
+
* already gated by the footer position and a plugged scrollable
|
|
61
77
|
*/
|
|
62
|
-
@property (nonatomic, assign) BOOL
|
|
78
|
+
@property (nonatomic, assign) BOOL footerInsetAdjustment;
|
|
63
79
|
|
|
64
80
|
/**
|
|
65
81
|
* Bottom safe-area inset the footer absorbs as padding — the footer
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
#import "TrueSheetViewController.h"
|
|
18
18
|
#import "core/TrueSheetKeyboardObserver.h"
|
|
19
19
|
#import "utils/UIView+ScrollEdgeInteraction.h"
|
|
20
|
-
#import "utils/WindowUtil.h"
|
|
21
20
|
|
|
22
21
|
#import <react/renderer/components/TrueSheetSpec/ComponentDescriptors.h>
|
|
23
22
|
#import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
|
|
@@ -33,7 +32,9 @@ using namespace facebook::react;
|
|
|
33
32
|
|
|
34
33
|
- (instancetype)init {
|
|
35
34
|
if (self = [super init]) {
|
|
35
|
+
_contentInsetAdjustment = TrueSheetViewContentInsetAdjustment::Automatic;
|
|
36
36
|
_keyboardScrollOffset = 0;
|
|
37
|
+
_keyboardOffset = 0;
|
|
37
38
|
_scrollingExpandsSheet = YES;
|
|
38
39
|
_topScrollEdgeEffect = TrueSheetViewTopScrollEdgeEffect::Hidden;
|
|
39
40
|
_bottomScrollEdgeEffect = TrueSheetViewBottomScrollEdgeEffect::Hidden;
|
|
@@ -41,6 +42,16 @@ using namespace facebook::react;
|
|
|
41
42
|
return self;
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
- (BOOL)safeAreaInsetAdjustment {
|
|
46
|
+
return _contentInsetAdjustment == TrueSheetViewContentInsetAdjustment::Automatic ||
|
|
47
|
+
_contentInsetAdjustment == TrueSheetViewContentInsetAdjustment::SafeArea;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
- (BOOL)footerInsetAdjustment {
|
|
51
|
+
return _contentInsetAdjustment == TrueSheetViewContentInsetAdjustment::Automatic ||
|
|
52
|
+
_contentInsetAdjustment == TrueSheetViewContentInsetAdjustment::Footer;
|
|
53
|
+
}
|
|
54
|
+
|
|
44
55
|
@end
|
|
45
56
|
|
|
46
57
|
@interface TrueSheetContainerView () <TrueSheetContentViewDelegate,
|
|
@@ -149,16 +160,20 @@ using namespace facebook::react;
|
|
|
149
160
|
- (void)setScrollableOptions:(ScrollableOptions *)scrollableOptions {
|
|
150
161
|
_scrollableOptions = scrollableOptions;
|
|
151
162
|
_contentView.keyboardScrollOffset = scrollableOptions ? scrollableOptions.keyboardScrollOffset : 0;
|
|
163
|
+
_contentView.keyboardOffset = scrollableOptions ? scrollableOptions.keyboardOffset : 0;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
- (void)setFooterInsetAdjustment:(BOOL)footerInsetAdjustment {
|
|
167
|
+
_footerInsetAdjustment = footerInsetAdjustment;
|
|
168
|
+
_contentView.footerInsetAdjustment = footerInsetAdjustment;
|
|
152
169
|
}
|
|
153
170
|
|
|
154
171
|
- (void)setupScrollable {
|
|
155
172
|
if (_contentView) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
_contentView.hasAutoDetent = _hasAutoDetent;
|
|
161
|
-
[_contentView setupScrollableWithBottomInset:bottomInset];
|
|
173
|
+
_contentView.scrollableHandle = _scrollableHandle;
|
|
174
|
+
_contentView.safeAreaInsetAdjustment = _safeAreaInsetAdjustment;
|
|
175
|
+
_contentView.footerInsetAdjustment = _footerInsetAdjustment;
|
|
176
|
+
[_contentView setupScrollable];
|
|
162
177
|
[_contentView applyScrollEdgeEffects:_scrollableOptions];
|
|
163
178
|
if (@available(iOS 26.0, *)) {
|
|
164
179
|
[self setupEdgeInteractions];
|
|
@@ -203,6 +218,7 @@ using namespace facebook::react;
|
|
|
203
218
|
_contentView = (TrueSheetContentView *)childComponentView;
|
|
204
219
|
_contentView.delegate = self;
|
|
205
220
|
_contentView.footerView = _footerView;
|
|
221
|
+
_contentView.footerInsetAdjustment = _footerInsetAdjustment;
|
|
206
222
|
|
|
207
223
|
// Children mount bottom-up, so the content subtree is complete here.
|
|
208
224
|
// Late-mounted peek views attach themselves instead (see TrueSheetPeekView).
|
|
@@ -232,22 +248,29 @@ using namespace facebook::react;
|
|
|
232
248
|
_contentView.footerView = _footerView;
|
|
233
249
|
[_footerView setBottomInset:_footerBottomInset];
|
|
234
250
|
[self footerViewDidChangeSize:_footerView.frame.size];
|
|
251
|
+
|
|
252
|
+
// The observer is set up on present — a footer mounted after that (e.g. a
|
|
253
|
+
// conditional one) joins it here and rises above a keyboard that's already open
|
|
254
|
+
_footerView.keyboardObserver = _keyboardObserver;
|
|
255
|
+
[self updateFooterKeyboardOffset];
|
|
235
256
|
}
|
|
236
257
|
}
|
|
237
258
|
|
|
238
259
|
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index {
|
|
239
|
-
if (
|
|
260
|
+
if (childComponentView == _contentView) {
|
|
261
|
+
_contentView.keyboardObserver = nil;
|
|
240
262
|
_contentView.delegate = nil;
|
|
241
263
|
_contentView = nil;
|
|
242
264
|
}
|
|
243
265
|
|
|
244
|
-
if (
|
|
266
|
+
if (childComponentView == _headerView) {
|
|
245
267
|
_headerView.delegate = nil;
|
|
246
268
|
_headerView = nil;
|
|
247
269
|
[self headerViewDidChangeSize:CGSizeZero];
|
|
248
270
|
}
|
|
249
271
|
|
|
250
|
-
if (
|
|
272
|
+
if (childComponentView == _footerView) {
|
|
273
|
+
_footerView.keyboardObserver = nil;
|
|
251
274
|
_footerView.delegate = nil;
|
|
252
275
|
_footerView = nil;
|
|
253
276
|
_contentView.footerView = nil;
|
|
@@ -271,6 +294,12 @@ using namespace facebook::react;
|
|
|
271
294
|
[self.delegate containerViewScrollViewDidChange];
|
|
272
295
|
}
|
|
273
296
|
|
|
297
|
+
// Footer controls can mount, unmount, or hide deep in its subtree without
|
|
298
|
+
// passing through its own mount hooks or changing its size.
|
|
299
|
+
- (void)contentViewDidMountTransaction {
|
|
300
|
+
[self.delegate containerViewDidMountTransaction];
|
|
301
|
+
}
|
|
302
|
+
|
|
274
303
|
#pragma mark - TrueSheetHeaderViewDelegate
|
|
275
304
|
|
|
276
305
|
- (void)headerViewDidChangeSize:(CGSize)newSize {
|
|
@@ -284,6 +313,7 @@ using namespace facebook::react;
|
|
|
284
313
|
|
|
285
314
|
- (void)footerViewDidChangeSize:(CGSize)newSize {
|
|
286
315
|
[self.delegate containerViewFooterDidChangeSize:newSize];
|
|
316
|
+
[_contentView updateBottomInset];
|
|
287
317
|
if (@available(iOS 26.0, *)) {
|
|
288
318
|
[self setupEdgeInteractions];
|
|
289
319
|
}
|
|
@@ -311,10 +341,9 @@ using namespace facebook::react;
|
|
|
311
341
|
return;
|
|
312
342
|
}
|
|
313
343
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}
|
|
344
|
+
// Last-attached wins. During a screen transition the incoming peek mounts
|
|
345
|
+
// before the outgoing one detaches, and the outgoing detach is a no-op.
|
|
346
|
+
_peekView.delegate = nil;
|
|
318
347
|
|
|
319
348
|
_peekView = peekView;
|
|
320
349
|
peekView.delegate = self;
|
|
@@ -342,17 +371,8 @@ using namespace facebook::react;
|
|
|
342
371
|
|
|
343
372
|
_keyboardObserver = [[TrueSheetKeyboardObserver alloc] init];
|
|
344
373
|
_keyboardObserver.viewController = (TrueSheetViewController *)viewController;
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
_contentView.keyboardObserver = _keyboardObserver;
|
|
348
|
-
[_keyboardObserver addDelegate:_contentView];
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
if (_footerView) {
|
|
352
|
-
_footerView.keyboardObserver = _keyboardObserver;
|
|
353
|
-
[_keyboardObserver addDelegate:_footerView];
|
|
354
|
-
}
|
|
355
|
-
|
|
374
|
+
_contentView.keyboardObserver = _keyboardObserver;
|
|
375
|
+
_footerView.keyboardObserver = _keyboardObserver;
|
|
356
376
|
[_keyboardObserver start];
|
|
357
377
|
}
|
|
358
378
|
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
10
10
|
|
|
11
|
+
#import <React/RCTMountingTransactionObserving.h>
|
|
11
12
|
#import <React/RCTSurfaceTouchHandler.h>
|
|
12
13
|
#import <React/RCTViewComponentView.h>
|
|
13
14
|
#import <UIKit/UIKit.h>
|
|
@@ -25,45 +26,73 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
25
26
|
|
|
26
27
|
- (void)contentViewDidChangeSize:(CGSize)newSize;
|
|
27
28
|
- (void)contentViewScrollViewDidChange;
|
|
29
|
+
- (void)contentViewDidMountTransaction;
|
|
28
30
|
|
|
29
31
|
@end
|
|
30
32
|
|
|
31
|
-
@interface TrueSheetContentView
|
|
33
|
+
@interface TrueSheetContentView
|
|
34
|
+
: RCTViewComponentView <TrueSheetKeyboardObserverDelegate, RCTMountingTransactionObserving>
|
|
32
35
|
|
|
33
36
|
@property (nonatomic, weak, nullable) id<TrueSheetContentViewDelegate> delegate;
|
|
34
37
|
@property (nonatomic, assign) CGFloat keyboardScrollOffset;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Adjustment added to the keyboard bottom inset applied to the detected
|
|
41
|
+
* scrollable — negative values reduce the inset (e.g. to cancel out safe-area
|
|
42
|
+
* padding already baked into the content's paddingBottom).
|
|
43
|
+
*/
|
|
44
|
+
@property (nonatomic, assign) CGFloat keyboardOffset;
|
|
45
|
+
|
|
35
46
|
@property (nonatomic, weak, nullable) TrueSheetKeyboardObserver *keyboardObserver;
|
|
36
47
|
|
|
37
48
|
/**
|
|
38
|
-
* Sibling footer view —
|
|
39
|
-
*
|
|
49
|
+
* Sibling footer view — a relative footer shields part of the keyboard's
|
|
50
|
+
* overlap from the inset; an absolute footer extends the caret reveal target.
|
|
40
51
|
*/
|
|
41
52
|
@property (nonatomic, weak, nullable) TrueSheetFooterView *footerView;
|
|
42
53
|
|
|
43
54
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
55
|
+
* Content height measured unconstrained by the shadow node — the height the
|
|
56
|
+
* content wants regardless of container bounds (see
|
|
57
|
+
* TrueSheetContentViewShadowNode). Falls back to the frame height before the
|
|
58
|
+
* first state update.
|
|
47
59
|
*/
|
|
48
|
-
@property (nonatomic,
|
|
60
|
+
@property (nonatomic, readonly) CGFloat naturalHeight;
|
|
49
61
|
|
|
50
62
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* Falls back to the frame height when no ScrollView is pinned.
|
|
63
|
+
* React tag of the user-provided scrollable (see the `scrollableRef` prop).
|
|
64
|
+
* Setting a new handle clears the currently resolved ScrollView.
|
|
54
65
|
*/
|
|
55
|
-
@property (nonatomic,
|
|
66
|
+
@property (nonatomic, assign) NSInteger scrollableHandle;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Sets the resolved ScrollView's `contentInsetAdjustmentBehavior` to
|
|
70
|
+
* `automatic` while plugged so UIKit applies the bottom safe-area inset to
|
|
71
|
+
* the scroll content. The previous behavior is restored on clear.
|
|
72
|
+
*/
|
|
73
|
+
@property (nonatomic, assign) BOOL safeAreaInsetAdjustment;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Pads the resolved ScrollView's bottom content inset by the absolute
|
|
77
|
+
* footer's height so the last item scrolls into view above it. Stacks with
|
|
78
|
+
* the keyboard inset.
|
|
79
|
+
*/
|
|
80
|
+
@property (nonatomic, assign) BOOL footerInsetAdjustment;
|
|
56
81
|
|
|
57
82
|
- (RCTScrollViewComponentView *_Nullable)findScrollView;
|
|
58
83
|
|
|
59
84
|
/**
|
|
60
|
-
*
|
|
61
|
-
|
|
85
|
+
* Re-applies the footer and keyboard insets — call when the footer's size changes
|
|
86
|
+
*/
|
|
87
|
+
- (void)updateBottomInset;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Resolve the ScrollView from `scrollableHandle`, wiring keyboard handling
|
|
62
91
|
*/
|
|
63
|
-
- (void)
|
|
92
|
+
- (void)setupScrollable;
|
|
64
93
|
|
|
65
94
|
/**
|
|
66
|
-
* Apply scroll edge effects to the
|
|
95
|
+
* Apply scroll edge effects to the detected scroll view (iOS 26+)
|
|
67
96
|
*/
|
|
68
97
|
- (void)applyScrollEdgeEffects:(nullable ScrollableOptions *)options;
|
|
69
98
|
|