@lodev09/react-native-true-sheet 4.0.0-beta.2 → 4.0.0-beta.20
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 +25 -4
- package/android/build.gradle +22 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerView.kt +50 -16
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +302 -184
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +5 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +21 -110
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayView.kt +116 -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 +18 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +119 -50
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +360 -163
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +54 -12
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBottomSheetView.kt +22 -9
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetCoordinatorLayout.kt +84 -5
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +104 -39
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDimView.kt +3 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetOverlayRootView.kt +137 -0
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetLifecycleEvents.kt +15 -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/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewComponentDescriptor.h +1 -9
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.cpp +110 -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 +9 -3
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.h +3 -6
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.cpp +1 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.h +4 -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 +27 -7
- package/ios/TrueSheetContainerView.mm +31 -11
- package/ios/TrueSheetContentView.h +43 -15
- package/ios/TrueSheetContentView.mm +211 -189
- package/ios/TrueSheetFooterView.h +6 -0
- package/ios/TrueSheetFooterView.mm +93 -17
- package/ios/TrueSheetModule.h +2 -7
- package/ios/TrueSheetModule.mm +7 -16
- package/ios/TrueSheetOverlayView.h +32 -0
- package/ios/TrueSheetOverlayView.mm +161 -0
- package/ios/TrueSheetView.mm +212 -55
- package/ios/TrueSheetViewController.h +31 -3
- package/ios/TrueSheetViewController.mm +393 -94
- package/ios/core/TrueSheetBlurView.h +0 -2
- package/ios/core/TrueSheetBlurView.mm +3 -36
- package/ios/core/TrueSheetDetentCalculator.h +7 -1
- package/ios/core/TrueSheetDetentCalculator.mm +27 -4
- package/ios/core/TrueSheetGrabberView.mm +13 -3
- package/ios/core/TrueSheetKeyboardObserver.mm +2 -0
- 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 +173 -39
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.web.js +218 -243
- 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/detentBackgrounds.js +21 -0
- package/lib/module/detentBackgrounds.js.map +1 -0
- package/lib/module/fabric/TrueSheetContentViewNativeComponent.ts +1 -1
- package/lib/module/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/lib/module/fabric/TrueSheetViewNativeComponent.ts +14 -10
- 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 +0 -9
- 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/index.js +10 -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/web/constants.js +1 -1
- package/lib/module/web/constants.js.map +1 -1
- package/lib/module/web/layout.js +168 -0
- package/lib/module/web/layout.js.map +1 -0
- package/lib/module/web/vaul/constants.js +4 -0
- package/lib/module/web/vaul/constants.js.map +1 -1
- 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 +44 -6
- package/lib/module/web/vaul/index.js.map +1 -1
- package/lib/module/web/vaul/use-snap-points.js +6 -8
- package/lib/module/web/vaul/use-snap-points.js.map +1 -1
- package/lib/typescript/src/TrueSheet.d.ts +6 -0
- package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.types.d.ts +135 -34
- 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/detentBackgrounds.d.ts +10 -0
- package/lib/typescript/src/detentBackgrounds.d.ts.map +1 -0
- 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 +11 -7
- 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 +2 -13
- 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/index.d.ts +8 -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 +41 -5
- package/lib/typescript/src/navigation/types.d.ts.map +1 -1
- 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/layout.d.ts +19 -0
- package/lib/typescript/src/web/layout.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/constants.d.ts +1 -0
- package/lib/typescript/src/web/vaul/constants.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/context.d.ts +1 -0
- 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 +7 -1
- package/lib/typescript/src/web/vaul/index.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/use-snap-points.d.ts.map +1 -1
- package/package.json +17 -8
- package/react-native.config.js +1 -0
- package/src/TrueSheet.tsx +206 -48
- package/src/TrueSheet.types.ts +142 -35
- package/src/TrueSheet.web.tsx +270 -290
- 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/detentBackgrounds.ts +24 -0
- package/src/fabric/TrueSheetContentViewNativeComponent.ts +1 -1
- package/src/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/src/fabric/TrueSheetViewNativeComponent.ts +14 -10
- 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 +5 -33
- package/src/navigation/expo-router/base-types.ts +18 -0
- package/src/navigation/expo-router/index.ts +28 -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 +75 -22
- package/src/web/constants.ts +1 -1
- package/src/web/layout.ts +196 -0
- package/src/web/vaul/constants.ts +4 -0
- package/src/web/vaul/context.ts +1 -0
- package/src/web/vaul/helpers.ts +5 -0
- package/src/web/vaul/index.tsx +67 -5
- package/src/web/vaul/use-snap-points.ts +6 -14
package/src/TrueSheet.types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
4
|
NativeSyntheticEvent,
|
|
@@ -36,6 +36,7 @@ export type WillPresentEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
|
36
36
|
export type DidPresentEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
37
37
|
export type WillDismissEvent = NativeSyntheticEvent<null>;
|
|
38
38
|
export type DidDismissEvent = NativeSyntheticEvent<null>;
|
|
39
|
+
export type DismissAttemptEvent = NativeSyntheticEvent<null>;
|
|
39
40
|
export type DragBeginEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
40
41
|
export type DragChangeEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
41
42
|
export type DragEndEvent = NativeSyntheticEvent<DetentInfoEventPayload>;
|
|
@@ -161,10 +162,44 @@ export interface AccessibilityOptions {
|
|
|
161
162
|
*/
|
|
162
163
|
export type ScrollEdgeEffect = 'automatic' | 'hard' | 'soft' | 'hidden';
|
|
163
164
|
|
|
165
|
+
/**
|
|
166
|
+
* What the sheet insets the bottom of a plugged scrollable's content for.
|
|
167
|
+
* See `ScrollableOptions.contentInsetAdjustment`.
|
|
168
|
+
*/
|
|
169
|
+
export type ContentInsetAdjustment = 'automatic' | 'safe-area' | 'footer' | 'never';
|
|
170
|
+
|
|
164
171
|
/**
|
|
165
172
|
* Options for scrollable behavior.
|
|
166
173
|
*/
|
|
167
174
|
export interface ScrollableOptions {
|
|
175
|
+
/**
|
|
176
|
+
* What the sheet insets the bottom of the scroll content for, so the last
|
|
177
|
+
* item clears whatever covers the scroll view's bottom edge.
|
|
178
|
+
*
|
|
179
|
+
* - `'automatic'`: The bottom safe-area inset while the content can scroll
|
|
180
|
+
* (home indicator on iOS, navigation bar on Android), plus the height of
|
|
181
|
+
* an `absolute` footer floating over the scroll view. The footer then
|
|
182
|
+
* counts toward the `auto` detent so the content ends above it.
|
|
183
|
+
* - `'safe-area'`: The safe-area inset only — content scrolls under an
|
|
184
|
+
* absolute footer.
|
|
185
|
+
* - `'footer'`: The absolute footer only — you pad for the safe area.
|
|
186
|
+
* - `'never'`: No inset — you pad the content yourself.
|
|
187
|
+
*
|
|
188
|
+
* The safe-area inset only applies while the sheet's `insetAdjustment` is
|
|
189
|
+
* `'automatic'`; a relative footer absorbs it instead. The footer inset is
|
|
190
|
+
* independent of `insetAdjustment` — it only covers the part of the footer
|
|
191
|
+
* overlapping the scroll view, and stacks with the keyboard inset while the
|
|
192
|
+
* footer rises above the keyboard.
|
|
193
|
+
*
|
|
194
|
+
* On iOS, the safe-area inset sets the scroll view's native
|
|
195
|
+
* [`contentInsetAdjustmentBehavior`](https://developer.apple.com/documentation/uikit/uiscrollview/contentinsetadjustmentbehavior)
|
|
196
|
+
* to `automatic` while it's plugged into the sheet; Android and Web apply
|
|
197
|
+
* the inset themselves.
|
|
198
|
+
*
|
|
199
|
+
* @default 'automatic'
|
|
200
|
+
*/
|
|
201
|
+
contentInsetAdjustment?: ContentInsetAdjustment;
|
|
202
|
+
|
|
168
203
|
/**
|
|
169
204
|
* Extra offset when scrolling to the focused input when keyboard appears.
|
|
170
205
|
*
|
|
@@ -172,6 +207,18 @@ export interface ScrollableOptions {
|
|
|
172
207
|
*/
|
|
173
208
|
keyboardScrollOffset?: number;
|
|
174
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Adjusts the bottom inset applied to the scrollable when the keyboard is shown.
|
|
212
|
+
* Positive values increase the inset; negative values reduce it.
|
|
213
|
+
* Pass `-insets.bottom` to cancel out safe-area padding already included in
|
|
214
|
+
* the content's `paddingBottom`.
|
|
215
|
+
* Does not affect the auto scroll of the focused input — it always targets
|
|
216
|
+
* the keyboard edge.
|
|
217
|
+
*
|
|
218
|
+
* @default 0
|
|
219
|
+
*/
|
|
220
|
+
keyboardOffset?: number;
|
|
221
|
+
|
|
175
222
|
/**
|
|
176
223
|
* Whether scrolling the content expands the sheet to the next detent.
|
|
177
224
|
* When `false`, only the grabber can expand the sheet.
|
|
@@ -241,28 +288,19 @@ export interface FooterOptions {
|
|
|
241
288
|
* @default 0
|
|
242
289
|
*/
|
|
243
290
|
keyboardOffset?: number;
|
|
244
|
-
}
|
|
245
291
|
|
|
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
292
|
/**
|
|
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.
|
|
293
|
+
* Whether an `absolute` footer rises above the keyboard when it opens.
|
|
294
|
+
* Set to `false` to keep the footer pinned to the sheet's bottom edge behind the keyboard.
|
|
295
|
+
* With footer inset adjustment enabled, any uncovered portion still adds scroll padding
|
|
296
|
+
* and contributes to the expanded `auto` height.
|
|
297
|
+
* The pinned footer keeps its safe-area padding and ignores `keyboardOffset`.
|
|
298
|
+
* A `relative` footer never rises, so this has no effect.
|
|
262
299
|
*
|
|
300
|
+
* @platform ios, android
|
|
263
301
|
* @default true
|
|
264
302
|
*/
|
|
265
|
-
|
|
303
|
+
avoidKeyboard?: boolean;
|
|
266
304
|
}
|
|
267
305
|
|
|
268
306
|
/**
|
|
@@ -308,6 +346,11 @@ export type BackgroundBlur =
|
|
|
308
346
|
| 'system-thick-material-dark'
|
|
309
347
|
| 'system-chrome-material-dark';
|
|
310
348
|
|
|
349
|
+
export type DetentBackground =
|
|
350
|
+
| string
|
|
351
|
+
| { color: ColorValue; blur?: never }
|
|
352
|
+
| { blur: BackgroundBlur; color?: never };
|
|
353
|
+
|
|
311
354
|
/**
|
|
312
355
|
* Supported Sheet detent.
|
|
313
356
|
*/
|
|
@@ -397,6 +440,21 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
397
440
|
*/
|
|
398
441
|
initialDetentAnimated?: boolean;
|
|
399
442
|
|
|
443
|
+
/**
|
|
444
|
+
* Specify whether the sheet content should mount lazily, on first presentation.
|
|
445
|
+
* Set to `false` to mount the content before presentation without presenting the sheet.
|
|
446
|
+
* Use this when content is not ready on the first render, then call `present()`
|
|
447
|
+
* after your readiness signal so auto detents measure the settled content.
|
|
448
|
+
*
|
|
449
|
+
* Content that requires window attachment to measure, such as SwiftUI-hosted views,
|
|
450
|
+
* still only measures during presentation.
|
|
451
|
+
*
|
|
452
|
+
* @platform android
|
|
453
|
+
* @platform ios
|
|
454
|
+
* @default true
|
|
455
|
+
*/
|
|
456
|
+
lazy?: boolean;
|
|
457
|
+
|
|
400
458
|
/**
|
|
401
459
|
* The detent index that the sheet should start to dim the background.
|
|
402
460
|
* This is ignored if `dimmed` is set to `false`.
|
|
@@ -407,6 +465,7 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
407
465
|
|
|
408
466
|
/**
|
|
409
467
|
* Prevents interactive dismissal of the Sheet.
|
|
468
|
+
* Blocked attempts fire `onDismissAttempt`, so you can confirm before dismissing programmatically.
|
|
410
469
|
*
|
|
411
470
|
* @default true
|
|
412
471
|
*/
|
|
@@ -423,9 +482,35 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
423
482
|
/**
|
|
424
483
|
* Main sheet background color.
|
|
425
484
|
* Uses system default when not provided.
|
|
485
|
+
*
|
|
486
|
+
* On supported iOS 26.1+ devices, uses a native color effect.
|
|
487
|
+
* `backgroundBlur` takes precedence on iOS.
|
|
488
|
+
* Use `backgroundStyle.backgroundColor` for an exact color or to tint glass or blur.
|
|
426
489
|
*/
|
|
427
490
|
backgroundColor?: ColorValue;
|
|
428
491
|
|
|
492
|
+
/**
|
|
493
|
+
* Backgrounds matched to `detents` by index. Strings are color values.
|
|
494
|
+
* Null or missing entries inherit
|
|
495
|
+
* `backgroundColor`/`backgroundBlur`. iOS 26.1+ transitions natively.
|
|
496
|
+
* Other platforms cross-fade after passing the midpoint between detents.
|
|
497
|
+
* Blur entries use the sheet background on Android and Web.
|
|
498
|
+
*/
|
|
499
|
+
detentBackgrounds?: (DetentBackground | null)[];
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Custom background rendered behind the header, content, and footer.
|
|
503
|
+
* The wrapper fills the sheet and ignores touches.
|
|
504
|
+
* Size the element to fill it with `StyleSheet.absoluteFill`.
|
|
505
|
+
*/
|
|
506
|
+
background?: ReactNode;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Style for the background wrapper. Only `backgroundColor` is supported.
|
|
510
|
+
* Use an opaque color for an exact color, or a translucent color to tint glass or blur.
|
|
511
|
+
*/
|
|
512
|
+
backgroundStyle?: StyleProp<Pick<ViewStyle, 'backgroundColor'>>;
|
|
513
|
+
|
|
429
514
|
/**
|
|
430
515
|
* The sheet corner radius.
|
|
431
516
|
*
|
|
@@ -471,20 +556,13 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
471
556
|
|
|
472
557
|
/**
|
|
473
558
|
* The blur effect style on iOS.
|
|
474
|
-
*
|
|
559
|
+
* Takes precedence over `backgroundColor`.
|
|
560
|
+
* Use `backgroundStyle.backgroundColor` to tint the blur.
|
|
475
561
|
*
|
|
476
562
|
* @platform ios
|
|
477
563
|
*/
|
|
478
564
|
backgroundBlur?: BackgroundBlur;
|
|
479
565
|
|
|
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
566
|
/**
|
|
489
567
|
* Overrides `large` or `100%` height.
|
|
490
568
|
* Also sets the maximum height for 'auto' detents.
|
|
@@ -500,27 +578,31 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
500
578
|
maxContentWidth?: number;
|
|
501
579
|
|
|
502
580
|
/**
|
|
503
|
-
*
|
|
581
|
+
* Horizontal placement of the sheet within the screen.
|
|
582
|
+
*
|
|
583
|
+
* - `'automatic'`: The system decides (default). Centered on Android, Web, and iOS 26 and below.
|
|
584
|
+
* - `'center'`: Centers the sheet horizontally.
|
|
585
|
+
* - `'leading'`: Places the sheet on the leading edge (left in LTR, right in RTL).
|
|
586
|
+
* - `'trailing'`: Places the sheet on the trailing edge (right in LTR, left in RTL).
|
|
504
587
|
*
|
|
505
|
-
*
|
|
506
|
-
*
|
|
507
|
-
* - `'right'`: Anchors the sheet to the right edge.
|
|
588
|
+
* `'automatic'` and `'center'` only differ on iOS 27+, where they map to
|
|
589
|
+
* `UISheetPresentationController.preferredPlacement`.
|
|
508
590
|
*
|
|
509
591
|
* Ignored on phones in portrait orientation.
|
|
510
592
|
*
|
|
511
|
-
* @default '
|
|
593
|
+
* @default 'automatic'
|
|
512
594
|
*/
|
|
513
|
-
|
|
595
|
+
placement?: 'automatic' | 'leading' | 'center' | 'trailing';
|
|
514
596
|
|
|
515
597
|
/**
|
|
516
598
|
* The offset from the screen edge.
|
|
517
|
-
* Only applies when `
|
|
599
|
+
* Only applies when `placement` is `'leading'` or `'trailing'`.
|
|
518
600
|
*
|
|
519
601
|
* @platform android
|
|
520
602
|
* @platform web
|
|
521
603
|
* @default 16
|
|
522
604
|
*/
|
|
523
|
-
|
|
605
|
+
placementOffset?: number;
|
|
524
606
|
|
|
525
607
|
/**
|
|
526
608
|
* Controls how the sheet adjusts its height for system insets (safe area).
|
|
@@ -568,8 +650,26 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
568
650
|
*/
|
|
569
651
|
footerStyle?: StyleProp<ViewStyle>;
|
|
570
652
|
|
|
653
|
+
/**
|
|
654
|
+
* A ref to the scrollable component (e.g. `ScrollView`, `FlatList`)
|
|
655
|
+
* rendered within the sheet content.
|
|
656
|
+
* Required for scrollable handling — nested scrolling, keyboard insets,
|
|
657
|
+
* and `auto` detent sizing are wired to this scrollable.
|
|
658
|
+
*
|
|
659
|
+
* Example:
|
|
660
|
+
* ```tsx
|
|
661
|
+
* const scrollableRef = useRef<ScrollView>(null)
|
|
662
|
+
*
|
|
663
|
+
* <TrueSheet scrollableRef={scrollableRef}>
|
|
664
|
+
* <ScrollView ref={scrollableRef} />
|
|
665
|
+
* </TrueSheet>
|
|
666
|
+
* ```
|
|
667
|
+
*/
|
|
668
|
+
scrollableRef?: RefObject<Component<unknown> | null>;
|
|
669
|
+
|
|
571
670
|
/**
|
|
572
671
|
* Options for scrollable behavior.
|
|
672
|
+
* Applies to the scrollable provided via `scrollableRef`.
|
|
573
673
|
*/
|
|
574
674
|
scrollableOptions?: ScrollableOptions;
|
|
575
675
|
|
|
@@ -621,6 +721,13 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
621
721
|
*/
|
|
622
722
|
onDidDismiss?: (event: DidDismissEvent) => void;
|
|
623
723
|
|
|
724
|
+
/**
|
|
725
|
+
* Called when the user tries to dismiss the sheet while `dismissible` is `false`,
|
|
726
|
+
* e.g. by dragging down or pressing back/escape. Tapping the dim does not count.
|
|
727
|
+
* The sheet stays presented. Confirm with the user, then call `dismiss()` to proceed.
|
|
728
|
+
*/
|
|
729
|
+
onDismissAttempt?: (event: DismissAttemptEvent) => void;
|
|
730
|
+
|
|
624
731
|
/**
|
|
625
732
|
* Called when the detent of the sheet has changed.
|
|
626
733
|
* Either by dragging or programatically.
|