You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> This package is not compatible with [Expo Go](https://docs.expo.dev/get-started/expo-go/). However, it does work with Expo [`prebuild`](https://docs.expo.dev/workflow/prebuild/).
31
+
> This package is not compatible with [Expo Go](https://docs.expo.dev/get-started/expo-go/). Use this with [Expo CNG](https://docs.expo.dev/workflow/continuous-native-generation/) instead.
33
32
34
33
## Usage
35
34
@@ -67,6 +66,7 @@ Extends `ViewProps`
67
66
| Prop | Type | Default | Description | 🍎 | 🤖 |
68
67
| - | - | - | - | - | - |
69
68
| sizes |[`SheetSize[]`](#sheetsize)|`["medium", "large"]`| Array of sizes you want the sheet to support. Maximum of _**3 sizes**_ only! **_collapsed_**, **_half-expanded_**, and **_expanded_**. Example: `size={["auto", "60%", "large"]}`| ✅ | ✅ |
69
+
| name |`string`| - | The name to reference this sheet. It has to be **_unique_**. You can then present this sheet globally using its name. | ✅ | ✅ |
| dismissible |`boolean`|`true`| If set to `false`, the sheet will prevent interactive dismissal via dragging or clicking outside of it. | ✅ | ✅ |
76
76
| grabber |`boolean`|`true`| Shows a grabber (or handle). Native on IOS and styled `View` on Android. | ✅ | ✅ |
77
77
| grabberProps |[`TrueSheetGrabberProps`](#truesheetgrabberprops)| - | Overrides the grabber props for android. || ✅ |
78
-
| blurTint |[`BlurTint`](#blurtint)| - | The blur effect style on iOS. Overrides `backgroundColor` if set. Example: `"light"`, `"dark"`, etc. | ✅ ||
79
-
| scrollRef |`RefObject<...>`| - | The main scrollable ref that the sheet should handle on iOS. | ✅ ||
78
+
| blurTint |[`BlurTint`](#blurtint)| - | The blur effect style on IOS. Overrides `backgroundColor` if set. Example: `"light"`, `"dark"`, etc. | ✅ ||
79
+
| scrollRef |`RefObject<...>`| - | The main scrollable ref that the sheet should handle on IOS. | ✅ ||
80
80
81
81
## Methods
82
82
@@ -108,6 +108,37 @@ return (
108
108
| resize |`index: number`| Resizes the sheet programmatically by `index`. This is an alias of the `present(index)` method. |
109
109
| dismiss | - | Dismisses the sheet. |
110
110
111
+
### Static Methods
112
+
113
+
You can also call the above methods statically without having access to a sheet's `ref`. This is particularly useful when you want to present a sheet from anywhere.
114
+
115
+
The API is similar to the ref methods except for the required `name` prop.
116
+
117
+
```ts
118
+
TrueSheet.present('SHEET-NAME')
119
+
TrueSheet.dismiss('SHEET-NAME')
120
+
TrueSheet.resize('SHEET-NAME', 1)
121
+
```
122
+
123
+
Example:
124
+
```tsx
125
+
// Define the sheet as usual
126
+
<TrueSheetname="my-sheet">
127
+
// ...
128
+
</TrueSheet>
129
+
```
130
+
```tsx
131
+
// Somewhere in your screen
132
+
const presentMySheet =async () => {
133
+
awaitTrueSheet.present('my-sheet')
134
+
console.log('🎉')
135
+
}
136
+
137
+
return (
138
+
<ButtononPress={presentMySheet} />
139
+
)
140
+
```
141
+
111
142
## Events
112
143
113
144
```tsx
@@ -166,7 +197,7 @@ Grabber props to be used for android grabber or handle.
166
197
167
198
### `BlurTint`
168
199
169
-
Blur tint that is mapped into native values in iOS.
200
+
Blur tint that is mapped into native values in IOS.
### Presenting a sheet on top of an existing sheet on **IOS**
259
+
260
+
On IOS, presenting a sheet on top of an existing sheet will cause error.
261
+
262
+
```console
263
+
Attempt to present <TrueSheet.TrueSheetViewController: 0x11829f800> on <UIViewController: 0x10900eb10> (from <RNSScreen: 0x117dbf400>) which is already presenting <TrueSheet.TrueSheetViewController: 0x11a0b9200>
264
+
```
265
+
266
+
There are _two_ ways to resolve this.
267
+
268
+
1. Dismiss the "parent" sheet first
269
+
```tsx
270
+
const presentSheet2 =async () => {
271
+
awaitsheet1.current?.dismiss() // Wait for sheet 1 to dismiss ✅
272
+
awaitsheet2.current?.present() // Sheet 2 will now present 🎉
On iOS, navigating to a [React Navigation](https://reactnavigation.org) screen from within the Sheet can cause issues. To resolve this, dismiss the sheet before navigating!
339
+
OnIOS, navigatingtoa [ReactNavigation](https://reactnavigation.org) screen from within the Sheet can cause issues. To resolve this, dismiss the sheet before navigating!
260
340
261
341
Example:
262
342
```tsx
@@ -283,7 +363,6 @@ The sheet does not have control over how React Native renders components and may
0 commit comments