@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
package/src/TrueSheet.types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ComponentType, ReactElement } from 'react';
|
|
1
|
+
import type { Component, ComponentType, ReactElement, ReactNode, RefObject } from 'react';
|
|
2
2
|
import type {
|
|
3
3
|
ColorValue,
|
|
4
|
+
HostInstance,
|
|
4
5
|
NativeSyntheticEvent,
|
|
5
6
|
StyleProp,
|
|
6
7
|
ViewProps,
|
|
@@ -36,6 +37,7 @@ export type WillPresentEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
|
36
37
|
export type DidPresentEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
37
38
|
export type WillDismissEvent = NativeSyntheticEvent<null>;
|
|
38
39
|
export type DidDismissEvent = NativeSyntheticEvent<null>;
|
|
40
|
+
export type DismissAttemptEvent = NativeSyntheticEvent<null>;
|
|
39
41
|
export type DragBeginEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
40
42
|
export type DragChangeEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
41
43
|
export type DragEndEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
@@ -161,10 +163,44 @@ export interface AccessibilityOptions {
|
|
|
161
163
|
*/
|
|
162
164
|
export type ScrollEdgeEffect = 'automatic' | 'hard' | 'soft' | 'hidden';
|
|
163
165
|
|
|
166
|
+
/**
|
|
167
|
+
* What the sheet insets the bottom of a plugged scrollable's content for.
|
|
168
|
+
* See `ScrollableOptions.contentInsetAdjustment`.
|
|
169
|
+
*/
|
|
170
|
+
export type ContentInsetAdjustment = 'automatic' | 'safe-area' | 'footer' | 'never';
|
|
171
|
+
|
|
164
172
|
/**
|
|
165
173
|
* Options for scrollable behavior.
|
|
166
174
|
*/
|
|
167
175
|
export interface ScrollableOptions {
|
|
176
|
+
/**
|
|
177
|
+
* What the sheet insets the bottom of the scroll content for, so the last
|
|
178
|
+
* item clears whatever covers the scroll view's bottom edge.
|
|
179
|
+
*
|
|
180
|
+
* - `'automatic'`: The bottom safe-area inset while the content can scroll
|
|
181
|
+
* (home indicator on iOS, navigation bar on Android), plus the height of
|
|
182
|
+
* an `absolute` footer floating over the scroll view. The footer then
|
|
183
|
+
* counts toward the `auto` detent so the content ends above it.
|
|
184
|
+
* - `'safe-area'`: The safe-area inset only — content scrolls under an
|
|
185
|
+
* absolute footer.
|
|
186
|
+
* - `'footer'`: The absolute footer only — you pad for the safe area.
|
|
187
|
+
* - `'never'`: No inset — you pad the content yourself.
|
|
188
|
+
*
|
|
189
|
+
* The safe-area inset only applies while the sheet's `insetAdjustment` is
|
|
190
|
+
* `'automatic'`; a relative footer absorbs it instead. The footer inset is
|
|
191
|
+
* independent of `insetAdjustment` — it only covers the part of the footer
|
|
192
|
+
* overlapping the scroll view, and stacks with the keyboard inset while the
|
|
193
|
+
* footer rises above the keyboard.
|
|
194
|
+
*
|
|
195
|
+
* On iOS, the safe-area inset sets the scroll view's native
|
|
196
|
+
* [`contentInsetAdjustmentBehavior`](https://developer.apple.com/documentation/uikit/uiscrollview/contentinsetadjustmentbehavior)
|
|
197
|
+
* to `automatic` while it's plugged into the sheet; Android and Web apply
|
|
198
|
+
* the inset themselves.
|
|
199
|
+
*
|
|
200
|
+
* @default 'automatic'
|
|
201
|
+
*/
|
|
202
|
+
contentInsetAdjustment?: ContentInsetAdjustment;
|
|
203
|
+
|
|
168
204
|
/**
|
|
169
205
|
* Extra offset when scrolling to the focused input when keyboard appears.
|
|
170
206
|
*
|
|
@@ -172,6 +208,18 @@ export interface ScrollableOptions {
|
|
|
172
208
|
*/
|
|
173
209
|
keyboardScrollOffset?: number;
|
|
174
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Adjusts the bottom inset applied to the scrollable when the keyboard is shown.
|
|
213
|
+
* Positive values increase the inset; negative values reduce it.
|
|
214
|
+
* Pass `-insets.bottom` to cancel out safe-area padding already included in
|
|
215
|
+
* the content's `paddingBottom`.
|
|
216
|
+
* Does not affect the auto scroll of the focused input — it always targets
|
|
217
|
+
* the keyboard edge.
|
|
218
|
+
*
|
|
219
|
+
* @default 0
|
|
220
|
+
*/
|
|
221
|
+
keyboardOffset?: number;
|
|
222
|
+
|
|
175
223
|
/**
|
|
176
224
|
* Whether scrolling the content expands the sheet to the next detent.
|
|
177
225
|
* When `false`, only the grabber can expand the sheet.
|
|
@@ -214,6 +262,33 @@ export interface HeaderOptions {
|
|
|
214
262
|
position?: 'relative' | 'absolute';
|
|
215
263
|
}
|
|
216
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Options for foldables. Applies while the device is half-open with a horizontal
|
|
267
|
+
* fold (tabletop). In book posture (vertical fold), iOS already keeps sheets on
|
|
268
|
+
* one panel — use `placement` to pick the side.
|
|
269
|
+
*/
|
|
270
|
+
export interface FoldOptions {
|
|
271
|
+
/**
|
|
272
|
+
* The detent that rests on the hinge in tabletop, so the sheet fills the panel
|
|
273
|
+
* below it. In any other posture the detent keeps its own value. Lower detents
|
|
274
|
+
* stay below it and higher ones above it, so the detents keep their order.
|
|
275
|
+
*/
|
|
276
|
+
hingeDetentIndex?: number;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* How the sheet treats the hinge in tabletop.
|
|
280
|
+
*
|
|
281
|
+
* - `'none'`: Detents are free to cross the hinge.
|
|
282
|
+
* - `'avoid'`: Caps every detent at the hinge, so the sheet never crosses it.
|
|
283
|
+
* - `'snap'`: Like `'avoid'`, and also moves the sheet to `hingeDetentIndex` when
|
|
284
|
+
* the device enters tabletop, then back to its previous detent when it leaves,
|
|
285
|
+
* unless the sheet was moved off the hinge in between.
|
|
286
|
+
*
|
|
287
|
+
* @default 'none'
|
|
288
|
+
*/
|
|
289
|
+
hingeBehavior?: 'none' | 'avoid' | 'snap';
|
|
290
|
+
}
|
|
291
|
+
|
|
217
292
|
/**
|
|
218
293
|
* Options for footer behavior
|
|
219
294
|
*/
|
|
@@ -241,28 +316,19 @@ export interface FooterOptions {
|
|
|
241
316
|
* @default 0
|
|
242
317
|
*/
|
|
243
318
|
keyboardOffset?: number;
|
|
244
|
-
}
|
|
245
319
|
|
|
246
|
-
/**
|
|
247
|
-
* Options for customizing the blur effect.
|
|
248
|
-
* Only applies when `backgroundBlur` is set.
|
|
249
|
-
*
|
|
250
|
-
* @platform ios
|
|
251
|
-
*/
|
|
252
|
-
export interface BlurOptions {
|
|
253
320
|
/**
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
*
|
|
260
|
-
* Disabling this can help with visual artifacts (flash) on iOS 18+
|
|
261
|
-
* when touching the sheet content with blur enabled.
|
|
321
|
+
* Whether an `absolute` footer rises above the keyboard when it opens.
|
|
322
|
+
* Set to `false` to keep the footer pinned to the sheet's bottom edge behind the keyboard.
|
|
323
|
+
* With footer inset adjustment enabled, any uncovered portion still adds scroll padding
|
|
324
|
+
* and contributes to the expanded `auto` height.
|
|
325
|
+
* The pinned footer keeps its safe-area padding and ignores `keyboardOffset`.
|
|
326
|
+
* A `relative` footer never rises, so this has no effect.
|
|
262
327
|
*
|
|
328
|
+
* @platform ios, android
|
|
263
329
|
* @default true
|
|
264
330
|
*/
|
|
265
|
-
|
|
331
|
+
avoidKeyboard?: boolean;
|
|
266
332
|
}
|
|
267
333
|
|
|
268
334
|
/**
|
|
@@ -280,6 +346,20 @@ export type InsetAdjustment =
|
|
|
280
346
|
*/
|
|
281
347
|
| 'never';
|
|
282
348
|
|
|
349
|
+
/**
|
|
350
|
+
* How far the sheet must be swiped down from its lowest detent to dismiss.
|
|
351
|
+
*/
|
|
352
|
+
export type DismissThreshold =
|
|
353
|
+
/**
|
|
354
|
+
* Past half of the lowest detent, or a quick flick. Matches iOS.
|
|
355
|
+
*/
|
|
356
|
+
| 'half'
|
|
357
|
+
/**
|
|
358
|
+
* A short drag (56 dp) or any downward fling (125 dp/s),
|
|
359
|
+
* like Compose Material3's `ModalBottomSheet`.
|
|
360
|
+
*/
|
|
361
|
+
| 'short';
|
|
362
|
+
|
|
283
363
|
/**
|
|
284
364
|
* Blur style mapped to native values in IOS.
|
|
285
365
|
*
|
|
@@ -308,6 +388,11 @@ export type BackgroundBlur =
|
|
|
308
388
|
| 'system-thick-material-dark'
|
|
309
389
|
| 'system-chrome-material-dark';
|
|
310
390
|
|
|
391
|
+
export type DetentBackground =
|
|
392
|
+
| string
|
|
393
|
+
| { color: ColorValue; blur?: never }
|
|
394
|
+
| { blur: BackgroundBlur; color?: never };
|
|
395
|
+
|
|
311
396
|
/**
|
|
312
397
|
* Supported Sheet detent.
|
|
313
398
|
*/
|
|
@@ -381,6 +466,22 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
381
466
|
*/
|
|
382
467
|
dimmed?: boolean;
|
|
383
468
|
|
|
469
|
+
/**
|
|
470
|
+
* The color of the dim overlay behind the sheet.
|
|
471
|
+
* This is ignored if `dimmed` is set to `false`.
|
|
472
|
+
*
|
|
473
|
+
* @default '#000000'
|
|
474
|
+
*/
|
|
475
|
+
dimColor?: ColorValue;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* The maximum opacity of the dim overlay behind the sheet (0 to 1).
|
|
479
|
+
* This is ignored if `dimmed` is set to `false`.
|
|
480
|
+
*
|
|
481
|
+
* @default 0.5
|
|
482
|
+
*/
|
|
483
|
+
dimOpacity?: number;
|
|
484
|
+
|
|
384
485
|
/**
|
|
385
486
|
* Initially present the sheet, after mounting, at a given detent index.
|
|
386
487
|
*
|
|
@@ -397,6 +498,21 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
397
498
|
*/
|
|
398
499
|
initialDetentAnimated?: boolean;
|
|
399
500
|
|
|
501
|
+
/**
|
|
502
|
+
* Specify whether the sheet content should mount lazily, on first presentation.
|
|
503
|
+
* Set to `false` to mount the content before presentation without presenting the sheet.
|
|
504
|
+
* Use this when content is not ready on the first render, then call `present()`
|
|
505
|
+
* after your readiness signal so auto detents measure the settled content.
|
|
506
|
+
*
|
|
507
|
+
* Content that requires window attachment to measure, such as SwiftUI-hosted views,
|
|
508
|
+
* still only measures during presentation.
|
|
509
|
+
*
|
|
510
|
+
* @platform android
|
|
511
|
+
* @platform ios
|
|
512
|
+
* @default true
|
|
513
|
+
*/
|
|
514
|
+
lazy?: boolean;
|
|
515
|
+
|
|
400
516
|
/**
|
|
401
517
|
* The detent index that the sheet should start to dim the background.
|
|
402
518
|
* This is ignored if `dimmed` is set to `false`.
|
|
@@ -407,11 +523,22 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
407
523
|
|
|
408
524
|
/**
|
|
409
525
|
* Prevents interactive dismissal of the Sheet.
|
|
526
|
+
* Blocked attempts fire `onDismissAttempt`, so you can confirm before dismissing programmatically.
|
|
410
527
|
*
|
|
411
528
|
* @default true
|
|
412
529
|
*/
|
|
413
530
|
dismissible?: boolean;
|
|
414
531
|
|
|
532
|
+
/**
|
|
533
|
+
* How far the sheet must be swiped down from its lowest detent to dismiss.
|
|
534
|
+
* Set to `'short'` to dismiss on a short drag or fling, like Compose Material3's sheet.
|
|
535
|
+
*
|
|
536
|
+
* @platform android
|
|
537
|
+
* @platform web
|
|
538
|
+
* @default 'half'
|
|
539
|
+
*/
|
|
540
|
+
dismissThreshold?: DismissThreshold;
|
|
541
|
+
|
|
415
542
|
/**
|
|
416
543
|
* Enables or disables dragging the sheet to resize it.
|
|
417
544
|
* When disabled, the sheet becomes static and can only be resized programmatically.
|
|
@@ -423,9 +550,35 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
423
550
|
/**
|
|
424
551
|
* Main sheet background color.
|
|
425
552
|
* Uses system default when not provided.
|
|
553
|
+
*
|
|
554
|
+
* On supported iOS 26.1+ devices, uses a native color effect.
|
|
555
|
+
* `backgroundBlur` takes precedence on iOS.
|
|
556
|
+
* Use `backgroundStyle.backgroundColor` for an exact color or to tint glass or blur.
|
|
426
557
|
*/
|
|
427
558
|
backgroundColor?: ColorValue;
|
|
428
559
|
|
|
560
|
+
/**
|
|
561
|
+
* Backgrounds matched to `detents` by index. Strings are color values.
|
|
562
|
+
* Null or missing entries inherit
|
|
563
|
+
* `backgroundColor`/`backgroundBlur`. iOS 26.1+ transitions natively.
|
|
564
|
+
* Other platforms cross-fade after passing the midpoint between detents.
|
|
565
|
+
* Blur entries use the sheet background on Android and Web.
|
|
566
|
+
*/
|
|
567
|
+
detentBackgrounds?: (DetentBackground | null)[];
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Custom background rendered behind the header, content, and footer.
|
|
571
|
+
* The wrapper fills the sheet and ignores touches.
|
|
572
|
+
* Size the element to fill it with `StyleSheet.absoluteFill`.
|
|
573
|
+
*/
|
|
574
|
+
background?: ReactNode;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Style for the background wrapper. Only `backgroundColor` is supported.
|
|
578
|
+
* Use an opaque color for an exact color, or a translucent color to tint glass or blur.
|
|
579
|
+
*/
|
|
580
|
+
backgroundStyle?: StyleProp<Pick<ViewStyle, 'backgroundColor'>>;
|
|
581
|
+
|
|
429
582
|
/**
|
|
430
583
|
* The sheet corner radius.
|
|
431
584
|
*
|
|
@@ -471,20 +624,13 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
471
624
|
|
|
472
625
|
/**
|
|
473
626
|
* The blur effect style on iOS.
|
|
474
|
-
*
|
|
627
|
+
* Takes precedence over `backgroundColor`.
|
|
628
|
+
* Use `backgroundStyle.backgroundColor` to tint the blur.
|
|
475
629
|
*
|
|
476
630
|
* @platform ios
|
|
477
631
|
*/
|
|
478
632
|
backgroundBlur?: BackgroundBlur;
|
|
479
633
|
|
|
480
|
-
/**
|
|
481
|
-
* Options for customizing the blur effect.
|
|
482
|
-
* Only applies when `backgroundBlur` is set.
|
|
483
|
-
*
|
|
484
|
-
* @platform ios
|
|
485
|
-
*/
|
|
486
|
-
blurOptions?: BlurOptions;
|
|
487
|
-
|
|
488
634
|
/**
|
|
489
635
|
* Overrides `large` or `100%` height.
|
|
490
636
|
* Also sets the maximum height for 'auto' detents.
|
|
@@ -500,27 +646,38 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
500
646
|
maxContentWidth?: number;
|
|
501
647
|
|
|
502
648
|
/**
|
|
503
|
-
*
|
|
649
|
+
* Horizontal placement of the sheet within the screen.
|
|
650
|
+
*
|
|
651
|
+
* - `'automatic'`: The system decides (default). Centered on Android, Web, and iOS 26 and below.
|
|
652
|
+
* - `'center'`: Centers the sheet horizontally.
|
|
653
|
+
* - `'leading'`: Places the sheet on the leading edge (left in LTR, right in RTL).
|
|
654
|
+
* - `'trailing'`: Places the sheet on the trailing edge (right in LTR, left in RTL).
|
|
504
655
|
*
|
|
505
|
-
*
|
|
506
|
-
*
|
|
507
|
-
* - `'right'`: Anchors the sheet to the right edge.
|
|
656
|
+
* `'automatic'` and `'center'` only differ on iOS 27+, where they map to
|
|
657
|
+
* `UISheetPresentationController.preferredPlacement`.
|
|
508
658
|
*
|
|
509
659
|
* Ignored on phones in portrait orientation.
|
|
510
660
|
*
|
|
511
|
-
* @default '
|
|
661
|
+
* @default 'automatic'
|
|
512
662
|
*/
|
|
513
|
-
|
|
663
|
+
placement?: 'automatic' | 'leading' | 'center' | 'trailing';
|
|
514
664
|
|
|
515
665
|
/**
|
|
516
666
|
* The offset from the screen edge.
|
|
517
|
-
* Only applies when `
|
|
667
|
+
* Only applies when `placement` is `'leading'` or `'trailing'`.
|
|
518
668
|
*
|
|
519
669
|
* @platform android
|
|
520
670
|
* @platform web
|
|
521
671
|
* @default 16
|
|
522
672
|
*/
|
|
523
|
-
|
|
673
|
+
placementOffset?: number;
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* How the sheet behaves on a foldable.
|
|
677
|
+
*
|
|
678
|
+
* @platform ios 27.1+
|
|
679
|
+
*/
|
|
680
|
+
foldOptions?: FoldOptions;
|
|
524
681
|
|
|
525
682
|
/**
|
|
526
683
|
* Controls how the sheet adjusts its height for system insets (safe area).
|
|
@@ -568,8 +725,34 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
568
725
|
*/
|
|
569
726
|
footerStyle?: StyleProp<ViewStyle>;
|
|
570
727
|
|
|
728
|
+
/**
|
|
729
|
+
* A ref to the scrollable component (e.g. `ScrollView`, `FlatList`)
|
|
730
|
+
* rendered within the sheet content. Lists that expose an imperative handle
|
|
731
|
+
* (e.g. `LegendList`, `FlashList`) work too, through their
|
|
732
|
+
* `getScrollableNode()` or `getNativeScrollRef()`.
|
|
733
|
+
* Required for scrollable handling — nested scrolling, keyboard insets,
|
|
734
|
+
* and `auto` detent sizing are wired to this scrollable.
|
|
735
|
+
*
|
|
736
|
+
* Example:
|
|
737
|
+
* ```tsx
|
|
738
|
+
* const scrollableRef = useRef<ScrollView>(null)
|
|
739
|
+
*
|
|
740
|
+
* <TrueSheet scrollableRef={scrollableRef}>
|
|
741
|
+
* <ScrollView ref={scrollableRef} />
|
|
742
|
+
* </TrueSheet>
|
|
743
|
+
* ```
|
|
744
|
+
*/
|
|
745
|
+
scrollableRef?: RefObject<
|
|
746
|
+
| Component<unknown>
|
|
747
|
+
| HostInstance
|
|
748
|
+
| { getScrollableNode(): unknown }
|
|
749
|
+
| { getNativeScrollRef(): unknown }
|
|
750
|
+
| null
|
|
751
|
+
>;
|
|
752
|
+
|
|
571
753
|
/**
|
|
572
754
|
* Options for scrollable behavior.
|
|
755
|
+
* Applies to the scrollable provided via `scrollableRef`.
|
|
573
756
|
*/
|
|
574
757
|
scrollableOptions?: ScrollableOptions;
|
|
575
758
|
|
|
@@ -621,6 +804,13 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
621
804
|
*/
|
|
622
805
|
onDidDismiss?: (event: DidDismissEvent) => void;
|
|
623
806
|
|
|
807
|
+
/**
|
|
808
|
+
* Called when the user tries to dismiss the sheet while `dismissible` is `false`,
|
|
809
|
+
* e.g. by dragging down or pressing back/escape. Tapping the dim does not count.
|
|
810
|
+
* The sheet stays presented. Confirm with the user, then call `dismiss()` to proceed.
|
|
811
|
+
*/
|
|
812
|
+
onDismissAttempt?: (event: DismissAttemptEvent) => void;
|
|
813
|
+
|
|
624
814
|
/**
|
|
625
815
|
* Called when the detent of the sheet has changed.
|
|
626
816
|
* Either by dragging or programatically.
|