@lodev09/react-native-true-sheet 4.0.0-beta.2 → 4.0.0-beta.21
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 +303 -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 +124 -50
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +369 -163
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +59 -12
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBottomSheetBehavior.kt +126 -0
- 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 +275 -56
- 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 +175 -39
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.web.js +220 -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 +15 -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 +9 -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 +47 -7
- package/lib/module/web/vaul/index.js.map +1 -1
- package/lib/module/web/vaul/use-snap-points.js +21 -10
- 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 +157 -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 +12 -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 +3 -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 +13 -1
- package/lib/typescript/src/web/vaul/index.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/use-snap-points.d.ts +2 -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 +208 -48
- package/src/TrueSheet.types.ts +166 -35
- package/src/TrueSheet.web.tsx +272 -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 +15 -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 +9 -0
- package/src/web/vaul/context.ts +1 -0
- package/src/web/vaul/helpers.ts +5 -0
- package/src/web/vaul/index.tsx +75 -5
- package/src/web/vaul/use-snap-points.ts +32 -15
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
|
-
/**
|
|
254
|
-
* The intensity of the blur effect (0-100).
|
|
255
|
-
* Uses system default if not provided.
|
|
256
|
-
*/
|
|
257
|
-
intensity?: number;
|
|
258
292
|
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
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
|
/**
|
|
@@ -280,6 +318,20 @@ export type InsetAdjustment =
|
|
|
280
318
|
*/
|
|
281
319
|
| 'never';
|
|
282
320
|
|
|
321
|
+
/**
|
|
322
|
+
* How far the sheet must be swiped down from its lowest detent to dismiss.
|
|
323
|
+
*/
|
|
324
|
+
export type DismissThreshold =
|
|
325
|
+
/**
|
|
326
|
+
* Past half of the lowest detent, or a quick flick. Matches iOS.
|
|
327
|
+
*/
|
|
328
|
+
| 'half'
|
|
329
|
+
/**
|
|
330
|
+
* A short drag (56 dp) or any downward fling (125 dp/s),
|
|
331
|
+
* like Compose Material3's `ModalBottomSheet`.
|
|
332
|
+
*/
|
|
333
|
+
| 'short';
|
|
334
|
+
|
|
283
335
|
/**
|
|
284
336
|
* Blur style mapped to native values in IOS.
|
|
285
337
|
*
|
|
@@ -308,6 +360,11 @@ export type BackgroundBlur =
|
|
|
308
360
|
| 'system-thick-material-dark'
|
|
309
361
|
| 'system-chrome-material-dark';
|
|
310
362
|
|
|
363
|
+
export type DetentBackground =
|
|
364
|
+
| string
|
|
365
|
+
| { color: ColorValue; blur?: never }
|
|
366
|
+
| { blur: BackgroundBlur; color?: never };
|
|
367
|
+
|
|
311
368
|
/**
|
|
312
369
|
* Supported Sheet detent.
|
|
313
370
|
*/
|
|
@@ -397,6 +454,21 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
397
454
|
*/
|
|
398
455
|
initialDetentAnimated?: boolean;
|
|
399
456
|
|
|
457
|
+
/**
|
|
458
|
+
* Specify whether the sheet content should mount lazily, on first presentation.
|
|
459
|
+
* Set to `false` to mount the content before presentation without presenting the sheet.
|
|
460
|
+
* Use this when content is not ready on the first render, then call `present()`
|
|
461
|
+
* after your readiness signal so auto detents measure the settled content.
|
|
462
|
+
*
|
|
463
|
+
* Content that requires window attachment to measure, such as SwiftUI-hosted views,
|
|
464
|
+
* still only measures during presentation.
|
|
465
|
+
*
|
|
466
|
+
* @platform android
|
|
467
|
+
* @platform ios
|
|
468
|
+
* @default true
|
|
469
|
+
*/
|
|
470
|
+
lazy?: boolean;
|
|
471
|
+
|
|
400
472
|
/**
|
|
401
473
|
* The detent index that the sheet should start to dim the background.
|
|
402
474
|
* This is ignored if `dimmed` is set to `false`.
|
|
@@ -407,11 +479,22 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
407
479
|
|
|
408
480
|
/**
|
|
409
481
|
* Prevents interactive dismissal of the Sheet.
|
|
482
|
+
* Blocked attempts fire `onDismissAttempt`, so you can confirm before dismissing programmatically.
|
|
410
483
|
*
|
|
411
484
|
* @default true
|
|
412
485
|
*/
|
|
413
486
|
dismissible?: boolean;
|
|
414
487
|
|
|
488
|
+
/**
|
|
489
|
+
* How far the sheet must be swiped down from its lowest detent to dismiss.
|
|
490
|
+
* Set to `'short'` to dismiss on a short drag or fling, like Compose Material3's sheet.
|
|
491
|
+
*
|
|
492
|
+
* @platform android
|
|
493
|
+
* @platform web
|
|
494
|
+
* @default 'half'
|
|
495
|
+
*/
|
|
496
|
+
dismissThreshold?: DismissThreshold;
|
|
497
|
+
|
|
415
498
|
/**
|
|
416
499
|
* Enables or disables dragging the sheet to resize it.
|
|
417
500
|
* When disabled, the sheet becomes static and can only be resized programmatically.
|
|
@@ -423,9 +506,35 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
423
506
|
/**
|
|
424
507
|
* Main sheet background color.
|
|
425
508
|
* Uses system default when not provided.
|
|
509
|
+
*
|
|
510
|
+
* On supported iOS 26.1+ devices, uses a native color effect.
|
|
511
|
+
* `backgroundBlur` takes precedence on iOS.
|
|
512
|
+
* Use `backgroundStyle.backgroundColor` for an exact color or to tint glass or blur.
|
|
426
513
|
*/
|
|
427
514
|
backgroundColor?: ColorValue;
|
|
428
515
|
|
|
516
|
+
/**
|
|
517
|
+
* Backgrounds matched to `detents` by index. Strings are color values.
|
|
518
|
+
* Null or missing entries inherit
|
|
519
|
+
* `backgroundColor`/`backgroundBlur`. iOS 26.1+ transitions natively.
|
|
520
|
+
* Other platforms cross-fade after passing the midpoint between detents.
|
|
521
|
+
* Blur entries use the sheet background on Android and Web.
|
|
522
|
+
*/
|
|
523
|
+
detentBackgrounds?: (DetentBackground | null)[];
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Custom background rendered behind the header, content, and footer.
|
|
527
|
+
* The wrapper fills the sheet and ignores touches.
|
|
528
|
+
* Size the element to fill it with `StyleSheet.absoluteFill`.
|
|
529
|
+
*/
|
|
530
|
+
background?: ReactNode;
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Style for the background wrapper. Only `backgroundColor` is supported.
|
|
534
|
+
* Use an opaque color for an exact color, or a translucent color to tint glass or blur.
|
|
535
|
+
*/
|
|
536
|
+
backgroundStyle?: StyleProp<Pick<ViewStyle, 'backgroundColor'>>;
|
|
537
|
+
|
|
429
538
|
/**
|
|
430
539
|
* The sheet corner radius.
|
|
431
540
|
*
|
|
@@ -471,20 +580,13 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
471
580
|
|
|
472
581
|
/**
|
|
473
582
|
* The blur effect style on iOS.
|
|
474
|
-
*
|
|
583
|
+
* Takes precedence over `backgroundColor`.
|
|
584
|
+
* Use `backgroundStyle.backgroundColor` to tint the blur.
|
|
475
585
|
*
|
|
476
586
|
* @platform ios
|
|
477
587
|
*/
|
|
478
588
|
backgroundBlur?: BackgroundBlur;
|
|
479
589
|
|
|
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
590
|
/**
|
|
489
591
|
* Overrides `large` or `100%` height.
|
|
490
592
|
* Also sets the maximum height for 'auto' detents.
|
|
@@ -500,27 +602,31 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
500
602
|
maxContentWidth?: number;
|
|
501
603
|
|
|
502
604
|
/**
|
|
503
|
-
*
|
|
605
|
+
* Horizontal placement of the sheet within the screen.
|
|
606
|
+
*
|
|
607
|
+
* - `'automatic'`: The system decides (default). Centered on Android, Web, and iOS 26 and below.
|
|
608
|
+
* - `'center'`: Centers the sheet horizontally.
|
|
609
|
+
* - `'leading'`: Places the sheet on the leading edge (left in LTR, right in RTL).
|
|
610
|
+
* - `'trailing'`: Places the sheet on the trailing edge (right in LTR, left in RTL).
|
|
504
611
|
*
|
|
505
|
-
*
|
|
506
|
-
*
|
|
507
|
-
* - `'right'`: Anchors the sheet to the right edge.
|
|
612
|
+
* `'automatic'` and `'center'` only differ on iOS 27+, where they map to
|
|
613
|
+
* `UISheetPresentationController.preferredPlacement`.
|
|
508
614
|
*
|
|
509
615
|
* Ignored on phones in portrait orientation.
|
|
510
616
|
*
|
|
511
|
-
* @default '
|
|
617
|
+
* @default 'automatic'
|
|
512
618
|
*/
|
|
513
|
-
|
|
619
|
+
placement?: 'automatic' | 'leading' | 'center' | 'trailing';
|
|
514
620
|
|
|
515
621
|
/**
|
|
516
622
|
* The offset from the screen edge.
|
|
517
|
-
* Only applies when `
|
|
623
|
+
* Only applies when `placement` is `'leading'` or `'trailing'`.
|
|
518
624
|
*
|
|
519
625
|
* @platform android
|
|
520
626
|
* @platform web
|
|
521
627
|
* @default 16
|
|
522
628
|
*/
|
|
523
|
-
|
|
629
|
+
placementOffset?: number;
|
|
524
630
|
|
|
525
631
|
/**
|
|
526
632
|
* Controls how the sheet adjusts its height for system insets (safe area).
|
|
@@ -568,8 +674,26 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
568
674
|
*/
|
|
569
675
|
footerStyle?: StyleProp<ViewStyle>;
|
|
570
676
|
|
|
677
|
+
/**
|
|
678
|
+
* A ref to the scrollable component (e.g. `ScrollView`, `FlatList`)
|
|
679
|
+
* rendered within the sheet content.
|
|
680
|
+
* Required for scrollable handling — nested scrolling, keyboard insets,
|
|
681
|
+
* and `auto` detent sizing are wired to this scrollable.
|
|
682
|
+
*
|
|
683
|
+
* Example:
|
|
684
|
+
* ```tsx
|
|
685
|
+
* const scrollableRef = useRef<ScrollView>(null)
|
|
686
|
+
*
|
|
687
|
+
* <TrueSheet scrollableRef={scrollableRef}>
|
|
688
|
+
* <ScrollView ref={scrollableRef} />
|
|
689
|
+
* </TrueSheet>
|
|
690
|
+
* ```
|
|
691
|
+
*/
|
|
692
|
+
scrollableRef?: RefObject<Component<unknown> | null>;
|
|
693
|
+
|
|
571
694
|
/**
|
|
572
695
|
* Options for scrollable behavior.
|
|
696
|
+
* Applies to the scrollable provided via `scrollableRef`.
|
|
573
697
|
*/
|
|
574
698
|
scrollableOptions?: ScrollableOptions;
|
|
575
699
|
|
|
@@ -621,6 +745,13 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
621
745
|
*/
|
|
622
746
|
onDidDismiss?: (event: DidDismissEvent) => void;
|
|
623
747
|
|
|
748
|
+
/**
|
|
749
|
+
* Called when the user tries to dismiss the sheet while `dismissible` is `false`,
|
|
750
|
+
* e.g. by dragging down or pressing back/escape. Tapping the dim does not count.
|
|
751
|
+
* The sheet stays presented. Confirm with the user, then call `dismiss()` to proceed.
|
|
752
|
+
*/
|
|
753
|
+
onDismissAttempt?: (event: DismissAttemptEvent) => void;
|
|
754
|
+
|
|
624
755
|
/**
|
|
625
756
|
* Called when the detent of the sheet has changed.
|
|
626
757
|
* Either by dragging or programatically.
|