@lodev09/react-native-true-sheet 0.5.3 → 0.7.0
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 +12 -11
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +5 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +5 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBehavior.kt +1 -2
- package/ios/TrueSheetView.swift +52 -36
- package/ios/TrueSheetViewController.swift +10 -36
- package/ios/TrueSheetViewManager.m +1 -0
- package/lib/commonjs/TrueSheet.js +16 -7
- package/lib/commonjs/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.js +16 -7
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/typescript/src/TrueSheet.d.ts +6 -1
- package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +8 -0
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/TrueSheet.tsx +20 -12
- package/src/types.ts +9 -0
package/README.md
CHANGED
|
@@ -55,23 +55,23 @@ Extended from `ViewProps`
|
|
|
55
55
|
| Prop | Type | Default | Description | 🍎 | 🤖 |
|
|
56
56
|
| - | - | - | - | - | - |
|
|
57
57
|
| sizes | [`SheetSize`](#sheetsize) | `['medium', 'large']` | The sizes you want the Sheet to support. Maximum of _**3 sizes**_ only! **_collapsed_**, **_half-expanded_** and **_expanded_**. Example: `size={['auto', '60%', 'large']}`| ✅ | ✅ |
|
|
58
|
-
| backgroundColor | `ColorValue` |
|
|
58
|
+
| backgroundColor | `ColorValue` | `white` | Main sheet background color. | ✅ | ✅ |
|
|
59
59
|
| cornerRadius | `number` | - | The sheet corner radius. | ✅ | ✅ |
|
|
60
60
|
| maxHeight | `number` | - | Overrides `large` or `100%` height. | ✅ | ✅ |
|
|
61
61
|
| contentContainerStyle | `StyleProp<ViewStyle>` | - | Optional content container styles. | ✅ | ✅ |
|
|
62
62
|
| FooterComponent | `ReactNode` | - | A component that floats at the bottom of the Sheet. | ✅ | ✅ |
|
|
63
|
-
|
|
|
63
|
+
| dismissible | `boolean` | `true` | Prevents interactive dismissal of the Sheet. | ✅ | ✅ |
|
|
64
|
+
| grabber | `boolean` | `true` | Shows native grabber (or handle) on iOS. | ✅ | |
|
|
64
65
|
| blurTint | [`BlurTint`](#blurTint) | - | The blur effect style on iOS. Overrides `backgroundColor` if set. Example: `light`, `dark`, etc. | ✅ | |
|
|
65
|
-
| scrollRef | `RefObject<...>` | - | The main scrollable ref that Sheet should handle on
|
|
66
|
+
| scrollRef | `RefObject<...>` | - | The main scrollable ref that Sheet should handle on iOS. | ✅ | |
|
|
66
67
|
|
|
67
68
|
## Methods
|
|
68
69
|
|
|
69
70
|
```ts
|
|
70
71
|
const sheet = useRef<TrueSheet>(null)
|
|
71
72
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
sheet.current?.present(1)
|
|
73
|
+
const resize = () => {
|
|
74
|
+
sheet.current?.resize(1)
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
const dismiss = () => {
|
|
@@ -80,7 +80,7 @@ const dismiss = () => {
|
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
82
|
<View>
|
|
83
|
-
<Button onPress={
|
|
83
|
+
<Button onPress={resize} title="Resize to 80%" />
|
|
84
84
|
<Button onPress={dismiss} title="Dimiss" />
|
|
85
85
|
<TrueSheet sizes={['auto', '80%']} ref={sheet}>
|
|
86
86
|
// ...
|
|
@@ -91,7 +91,8 @@ return (
|
|
|
91
91
|
|
|
92
92
|
| Name | Parameters | Description |
|
|
93
93
|
| - | - | - |
|
|
94
|
-
| present | `index: number = 0` | Present the modal sheet
|
|
94
|
+
| present | `index: number = 0` | Present the modal sheet. Optionally accepts a size `index`. See `sizes` prop. |
|
|
95
|
+
| resize | `index: number` | Resizes the Sheet programmatically by `index`. This is an alias of the `present(index)` method. |
|
|
95
96
|
| dismiss | - | Dismisses the Sheet. |
|
|
96
97
|
|
|
97
98
|
## Events
|
|
@@ -110,9 +111,9 @@ return (
|
|
|
110
111
|
|
|
111
112
|
| Name | Parameters | Description |
|
|
112
113
|
| - | - | - |
|
|
113
|
-
| onPresent |
|
|
114
|
+
| onPresent | [`SizeInfo`](#sizeinfo) | Called when the Sheet has been presented. Comes with the size index and value. |
|
|
114
115
|
| onDismiss | - | Called when the Sheet has been dismissed. |
|
|
115
|
-
| onSizeChange | [`SizeInfo`](#sizeinfo) | Called when the size of the sheet has changed. Either by dragging or programatically. |
|
|
116
|
+
| onSizeChange | [`SizeInfo`](#sizeinfo) | Called when the size of the sheet has changed. Either by dragging or presenting programatically. Comes with the size index and value. |
|
|
116
117
|
|
|
117
118
|
## Types
|
|
118
119
|
|
|
@@ -135,7 +136,7 @@ return (
|
|
|
135
136
|
|
|
136
137
|
### `BlurTint`
|
|
137
138
|
|
|
138
|
-
Blur
|
|
139
|
+
Blur tint that is mapped into native values in iOS.
|
|
139
140
|
|
|
140
141
|
```ts
|
|
141
142
|
<TrueSheet blurTint="dark">
|
|
@@ -215,6 +215,11 @@ class TrueSheetView(context: Context) :
|
|
|
215
215
|
sheetBehavior.configure()
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
fun setDismissible(dismissible: Boolean) {
|
|
219
|
+
sheetBehavior.isHideable = dismissible
|
|
220
|
+
sheetDialog.setCancelable(dismissible)
|
|
221
|
+
}
|
|
222
|
+
|
|
218
223
|
fun setSizes(newSizes: Array<Any>) {
|
|
219
224
|
sheetBehavior.sizes = newSizes
|
|
220
225
|
sheetBehavior.configure()
|
|
@@ -34,6 +34,11 @@ class TrueSheetViewManager : ViewGroupManager<TrueSheetView>() {
|
|
|
34
34
|
view.setMaxHeight(Utils.toPixel(height))
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
@ReactProp(name = "dismissible")
|
|
38
|
+
fun setDismissible(view: TrueSheetView, dismissible: Boolean) {
|
|
39
|
+
view.setDismissible(dismissible)
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
@ReactProp(name = "sizes")
|
|
38
43
|
fun setSizes(view: TrueSheetView, sizes: ReadableArray) {
|
|
39
44
|
val result = ArrayList<Any>()
|
|
@@ -108,7 +108,6 @@ class TrueSheetBehavior : BottomSheetBehavior<ViewGroup>() {
|
|
|
108
108
|
// Configure sheet sizes
|
|
109
109
|
apply {
|
|
110
110
|
isFitToContents = true
|
|
111
|
-
isHideable = true
|
|
112
111
|
skipCollapsed = false
|
|
113
112
|
|
|
114
113
|
when (sizes.size) {
|
|
@@ -134,7 +133,7 @@ class TrueSheetBehavior : BottomSheetBehavior<ViewGroup>() {
|
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
|
|
137
|
-
fun getStateForIndex(index: Int) =
|
|
136
|
+
private fun getStateForIndex(index: Int) =
|
|
138
137
|
when (sizes.size) {
|
|
139
138
|
1 -> STATE_EXPANDED
|
|
140
139
|
|
package/ios/TrueSheetView.swift
CHANGED
|
@@ -147,8 +147,17 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
func invalidate() {
|
|
151
|
+
viewController.dismiss(animated: true)
|
|
152
|
+
}
|
|
153
|
+
|
|
150
154
|
// MARK: - Prop setters
|
|
151
155
|
|
|
156
|
+
@objc
|
|
157
|
+
func setDismissible(_ dismissible: Bool) {
|
|
158
|
+
viewController.isModalInPresentation = !dismissible
|
|
159
|
+
}
|
|
160
|
+
|
|
152
161
|
@objc
|
|
153
162
|
func setMaxHeight(_ height: NSNumber) {
|
|
154
163
|
viewController.maxHeight = CGFloat(height.floatValue)
|
|
@@ -172,18 +181,28 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
172
181
|
}
|
|
173
182
|
|
|
174
183
|
@objc
|
|
175
|
-
func
|
|
176
|
-
|
|
184
|
+
func setCornerRadius(_ radius: NSNumber?) {
|
|
185
|
+
var cornerRadius: CGFloat?
|
|
186
|
+
if let radius {
|
|
187
|
+
cornerRadius = CGFloat(radius.floatValue)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
viewController.cornerRadius = cornerRadius
|
|
191
|
+
if #available(iOS 15.0, *) {
|
|
192
|
+
configureSheetIfPresented { sheet in
|
|
193
|
+
sheet.preferredCornerRadius = viewController.cornerRadius
|
|
194
|
+
}
|
|
195
|
+
}
|
|
177
196
|
}
|
|
178
197
|
|
|
179
198
|
@objc
|
|
180
|
-
func
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
199
|
+
func setGrabber(_ visible: Bool) {
|
|
200
|
+
viewController.grabber = visible
|
|
201
|
+
if #available(iOS 15.0, *) {
|
|
202
|
+
configureSheetIfPresented { sheet in
|
|
203
|
+
sheet.prefersGrabberVisible = visible
|
|
204
|
+
}
|
|
184
205
|
}
|
|
185
|
-
|
|
186
|
-
viewController.cornerRadius = CGFloat(radius.floatValue)
|
|
187
206
|
}
|
|
188
207
|
|
|
189
208
|
@objc
|
|
@@ -192,10 +211,6 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
192
211
|
rctScrollView = view
|
|
193
212
|
}
|
|
194
213
|
|
|
195
|
-
func invalidate() {
|
|
196
|
-
viewController.dismiss(animated: true)
|
|
197
|
-
}
|
|
198
|
-
|
|
199
214
|
// MARK: - Methods
|
|
200
215
|
|
|
201
216
|
private func sizeInfoData(from sizeInfo: SizeInfo?) -> [String: Any] {
|
|
@@ -206,9 +221,19 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
206
221
|
return ["index": sizeInfo.index, "value": sizeInfo.value]
|
|
207
222
|
}
|
|
208
223
|
|
|
224
|
+
/// Use to customize some properties of the Sheet
|
|
225
|
+
@available(iOS 15.0, *)
|
|
226
|
+
func configureSheetIfPresented(completion: (UISheetPresentationController) -> Void) {
|
|
227
|
+
guard isPresented, let sheet = viewController.sheetPresentationController else {
|
|
228
|
+
return
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
completion(sheet)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/// Full reconfiguration of the Sheet
|
|
209
235
|
func configureSheetIfPresented() {
|
|
210
|
-
|
|
211
|
-
if #available(iOS 15.0, *), isPresented {
|
|
236
|
+
if isPresented {
|
|
212
237
|
viewController.configureSheet(at: activeIndex ?? 0, with: contentHeight, nil)
|
|
213
238
|
}
|
|
214
239
|
}
|
|
@@ -261,31 +286,22 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
261
286
|
return
|
|
262
287
|
}
|
|
263
288
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
if isPresented {
|
|
273
|
-
promise.resolve(nil)
|
|
274
|
-
} else {
|
|
275
|
-
// Keep track of the active index
|
|
276
|
-
activeIndex = index
|
|
277
|
-
|
|
278
|
-
rvc.present(viewController, animated: true) {
|
|
279
|
-
self.isPresented = true
|
|
289
|
+
viewController.configureSheet(at: index, with: contentHeight) { sizeInfo in
|
|
290
|
+
// Trigger onSizeChange event when size is changed while presenting
|
|
291
|
+
if self.isPresented {
|
|
292
|
+
self.viewControllerSheetDidChangeSize(sizeInfo)
|
|
293
|
+
promise.resolve(nil)
|
|
294
|
+
} else {
|
|
295
|
+
// Keep track of the active index
|
|
296
|
+
self.activeIndex = index
|
|
280
297
|
|
|
281
|
-
|
|
298
|
+
rvc.present(self.viewController, animated: true) {
|
|
299
|
+
self.isPresented = true
|
|
282
300
|
|
|
283
|
-
|
|
284
|
-
|
|
301
|
+
let data = self.sizeInfoData(from: sizeInfo)
|
|
302
|
+
self.onPresent?(data)
|
|
303
|
+
promise.resolve(nil)
|
|
285
304
|
}
|
|
286
|
-
|
|
287
|
-
self.onPresent?(data)
|
|
288
|
-
promise.resolve(nil)
|
|
289
305
|
}
|
|
290
306
|
}
|
|
291
307
|
}
|
|
@@ -35,36 +35,8 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
|
|
|
35
35
|
|
|
36
36
|
var sizes: [Any] = ["medium", "large"]
|
|
37
37
|
var maxHeight: CGFloat?
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
didSet {
|
|
41
|
-
if #available(iOS 15.0, *) {
|
|
42
|
-
sheet?.preferredCornerRadius = cornerRadius
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
var grabber = true {
|
|
48
|
-
didSet {
|
|
49
|
-
if #available(iOS 15.0, *) {
|
|
50
|
-
sheet?.prefersGrabberVisible = grabber
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
@available(iOS 15.0, *)
|
|
56
|
-
var sheet: UISheetPresentationController? {
|
|
57
|
-
return sheetPresentationController
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@available(iOS 15.0, *)
|
|
61
|
-
var selectedSizeInfo: SizeInfo? {
|
|
62
|
-
guard let rawValue = sheet?.selectedDetentIdentifier?.rawValue else {
|
|
63
|
-
return nil
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return detentValues[rawValue]
|
|
67
|
-
}
|
|
38
|
+
var cornerRadius: CGFloat?
|
|
39
|
+
var grabber = true
|
|
68
40
|
|
|
69
41
|
// MARK: - Setup
|
|
70
42
|
|
|
@@ -115,10 +87,13 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
|
|
|
115
87
|
}
|
|
116
88
|
|
|
117
89
|
/// Prepares the view controller for sheet presentation
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
guard let sheet else {
|
|
90
|
+
func configureSheet(at index: Int = 0, with contentHeight: CGFloat, _ completion: ((SizeInfo) -> Void)?) {
|
|
91
|
+
let defaultSizeInfo = SizeInfo(index: index, value: view.bounds.height)
|
|
92
|
+
|
|
93
|
+
guard #available(iOS 15.0, *), let sheet = sheetPresentationController else {
|
|
94
|
+
completion?(defaultSizeInfo)
|
|
95
|
+
return
|
|
96
|
+
}
|
|
122
97
|
|
|
123
98
|
detentValues = [:]
|
|
124
99
|
|
|
@@ -136,7 +111,6 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
|
|
|
136
111
|
sheet.prefersEdgeAttachedInCompactHeight = true
|
|
137
112
|
sheet.prefersGrabberVisible = grabber
|
|
138
113
|
sheet.preferredCornerRadius = cornerRadius
|
|
139
|
-
|
|
140
114
|
sheet.delegate = self
|
|
141
115
|
|
|
142
116
|
var identifier: UISheetPresentationController.Detent.Identifier = .medium
|
|
@@ -152,7 +126,7 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
|
|
|
152
126
|
|
|
153
127
|
sheet.animateChanges {
|
|
154
128
|
sheet.selectedDetentIdentifier = identifier
|
|
155
|
-
completion?()
|
|
129
|
+
completion?(self.detentValues[identifier.rawValue] ?? defaultSizeInfo)
|
|
156
130
|
}
|
|
157
131
|
}
|
|
158
132
|
}
|
|
@@ -64,13 +64,21 @@ class TrueSheet extends _react.PureComponent {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* Present the modal sheet
|
|
67
|
+
* Present the modal sheet. Optionally accepts a size `index`.
|
|
68
68
|
* See `sizes` prop
|
|
69
69
|
*/
|
|
70
70
|
async present(index = 0) {
|
|
71
71
|
await _TrueSheetModule.TrueSheetModule.present(this.handle, index);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Resizes the Sheet programmatically by `index`.
|
|
76
|
+
* This is an alias of the `present(index)` method.
|
|
77
|
+
*/
|
|
78
|
+
async resize(index) {
|
|
79
|
+
await this.present(index);
|
|
80
|
+
}
|
|
81
|
+
|
|
74
82
|
/**
|
|
75
83
|
* Dismisses the Sheet
|
|
76
84
|
*/
|
|
@@ -80,10 +88,11 @@ class TrueSheet extends _react.PureComponent {
|
|
|
80
88
|
render() {
|
|
81
89
|
const {
|
|
82
90
|
sizes,
|
|
83
|
-
backgroundColor,
|
|
91
|
+
backgroundColor = 'white',
|
|
92
|
+
grabber = true,
|
|
93
|
+
dismissible = true,
|
|
84
94
|
blurTint,
|
|
85
95
|
cornerRadius,
|
|
86
|
-
grabber,
|
|
87
96
|
maxHeight,
|
|
88
97
|
FooterComponent,
|
|
89
98
|
style,
|
|
@@ -91,7 +100,6 @@ class TrueSheet extends _react.PureComponent {
|
|
|
91
100
|
children,
|
|
92
101
|
...rest
|
|
93
102
|
} = this.props;
|
|
94
|
-
const wrapperBackgroundColor = backgroundColor ?? 'white';
|
|
95
103
|
return /*#__PURE__*/_react.default.createElement(TrueSheetNativeView, {
|
|
96
104
|
ref: this.ref,
|
|
97
105
|
style: $nativeSheet,
|
|
@@ -99,7 +107,8 @@ class TrueSheet extends _react.PureComponent {
|
|
|
99
107
|
sizes: sizes ?? ['medium', 'large'],
|
|
100
108
|
blurTint: blurTint,
|
|
101
109
|
cornerRadius: cornerRadius,
|
|
102
|
-
grabber: grabber
|
|
110
|
+
grabber: grabber,
|
|
111
|
+
dismissible: dismissible,
|
|
103
112
|
maxHeight: maxHeight,
|
|
104
113
|
onPresent: this.onPresent,
|
|
105
114
|
onDismiss: this.onDismiss,
|
|
@@ -115,8 +124,8 @@ class TrueSheet extends _react.PureComponent {
|
|
|
115
124
|
borderTopRightRadius: cornerRadius,
|
|
116
125
|
// Remove backgroundColor if `blurTint` is set on iOS
|
|
117
126
|
backgroundColor: _reactNative.Platform.select({
|
|
118
|
-
ios: blurTint ? undefined :
|
|
119
|
-
android:
|
|
127
|
+
ios: blurTint ? undefined : backgroundColor,
|
|
128
|
+
android: backgroundColor
|
|
120
129
|
})
|
|
121
130
|
}, style]
|
|
122
131
|
}, rest), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_TrueSheetModule","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","LINKING_ERROR","Platform","select","ios","ComponentName","TrueSheetNativeView","requireNativeComponent","Error","TrueSheet","PureComponent","displayName","constructor","props","ref","createRef","onDismiss","onPresent","onSizeChange","state","scrollableHandle","handle","nodeHandle","findNodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","componentDidMount","sizes","console","warn","componentDidUpdate","present","index","TrueSheetModule","dismiss","render","backgroundColor","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_TrueSheetModule","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","LINKING_ERROR","Platform","select","ios","ComponentName","TrueSheetNativeView","requireNativeComponent","Error","TrueSheet","PureComponent","displayName","constructor","props","ref","createRef","onDismiss","onPresent","onSizeChange","state","scrollableHandle","handle","nodeHandle","findNodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","componentDidMount","sizes","console","warn","componentDidUpdate","present","index","TrueSheetModule","resize","dismiss","render","backgroundColor","grabber","dismissible","blurTint","cornerRadius","maxHeight","FooterComponent","style","contentContainerStyle","children","rest","createElement","$nativeSheet","View","collapsable","overflow","undefined","android","borderTopLeftRadius","borderTopRightRadius","exports","position","left","zIndex"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAWA,IAAAE,gBAAA,GAAAF,OAAA;AAAmD,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD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C,qBAAQ,CAACC,MAAM,CAAC;UAC/BC,GAAG,EAAEwC,QAAQ,GAAGa,SAAS,GAAGhB,eAAe;UAC3CiB,OAAO,EAAEjB;QACX,CAAC;MACH,CAAC,EACDO,KAAK;IACL,GACEG,IAAI,gBAERrF,MAAA,CAAAW,OAAA,CAAA2E,aAAA,CAACnF,YAAA,CAAAqF,IAAI;MAACC,WAAW,EAAE,KAAM;MAACP,KAAK,EAAEC;IAAsB,GACpDC,QACG,CAAC,eACPpF,MAAA,CAAAW,OAAA,CAAA2E,aAAA,CAACnF,YAAA,CAAAqF,IAAI;MAACC,WAAW,EAAE;IAAM,GAAE,CAAC,CAACR,eAAe,iBAAIjF,MAAA,CAAAW,OAAA,CAAA2E,aAAA,CAACL,eAAe,MAAE,CAAQ,CACtE,CACa,CAAC;EAE1B;AACF;AAACc,OAAA,CAAApD,SAAA,GAAAA,SAAA;AAED,MAAM4C,YAAuB,GAAG;EAC9BS,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,CAAC,IAAI;EACXC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]}
|
package/lib/module/TrueSheet.js
CHANGED
|
@@ -56,13 +56,21 @@ export class TrueSheet extends PureComponent {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
* Present the modal sheet
|
|
59
|
+
* Present the modal sheet. Optionally accepts a size `index`.
|
|
60
60
|
* See `sizes` prop
|
|
61
61
|
*/
|
|
62
62
|
async present(index = 0) {
|
|
63
63
|
await TrueSheetModule.present(this.handle, index);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Resizes the Sheet programmatically by `index`.
|
|
68
|
+
* This is an alias of the `present(index)` method.
|
|
69
|
+
*/
|
|
70
|
+
async resize(index) {
|
|
71
|
+
await this.present(index);
|
|
72
|
+
}
|
|
73
|
+
|
|
66
74
|
/**
|
|
67
75
|
* Dismisses the Sheet
|
|
68
76
|
*/
|
|
@@ -72,10 +80,11 @@ export class TrueSheet extends PureComponent {
|
|
|
72
80
|
render() {
|
|
73
81
|
const {
|
|
74
82
|
sizes,
|
|
75
|
-
backgroundColor,
|
|
83
|
+
backgroundColor = 'white',
|
|
84
|
+
grabber = true,
|
|
85
|
+
dismissible = true,
|
|
76
86
|
blurTint,
|
|
77
87
|
cornerRadius,
|
|
78
|
-
grabber,
|
|
79
88
|
maxHeight,
|
|
80
89
|
FooterComponent,
|
|
81
90
|
style,
|
|
@@ -83,7 +92,6 @@ export class TrueSheet extends PureComponent {
|
|
|
83
92
|
children,
|
|
84
93
|
...rest
|
|
85
94
|
} = this.props;
|
|
86
|
-
const wrapperBackgroundColor = backgroundColor ?? 'white';
|
|
87
95
|
return /*#__PURE__*/React.createElement(TrueSheetNativeView, {
|
|
88
96
|
ref: this.ref,
|
|
89
97
|
style: $nativeSheet,
|
|
@@ -91,7 +99,8 @@ export class TrueSheet extends PureComponent {
|
|
|
91
99
|
sizes: sizes ?? ['medium', 'large'],
|
|
92
100
|
blurTint: blurTint,
|
|
93
101
|
cornerRadius: cornerRadius,
|
|
94
|
-
grabber: grabber
|
|
102
|
+
grabber: grabber,
|
|
103
|
+
dismissible: dismissible,
|
|
95
104
|
maxHeight: maxHeight,
|
|
96
105
|
onPresent: this.onPresent,
|
|
97
106
|
onDismiss: this.onDismiss,
|
|
@@ -107,8 +116,8 @@ export class TrueSheet extends PureComponent {
|
|
|
107
116
|
borderTopRightRadius: cornerRadius,
|
|
108
117
|
// Remove backgroundColor if `blurTint` is set on iOS
|
|
109
118
|
backgroundColor: Platform.select({
|
|
110
|
-
ios: blurTint ? undefined :
|
|
111
|
-
android:
|
|
119
|
+
ios: blurTint ? undefined : backgroundColor,
|
|
120
|
+
android: backgroundColor
|
|
112
121
|
})
|
|
113
122
|
}, style]
|
|
114
123
|
}, rest), /*#__PURE__*/React.createElement(View, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","PureComponent","createRef","requireNativeComponent","Platform","findNodeHandle","View","TrueSheetModule","LINKING_ERROR","select","ios","default","ComponentName","TrueSheetNativeView","Error","TrueSheet","displayName","constructor","props","ref","onDismiss","bind","onPresent","onSizeChange","state","scrollableHandle","handle","nodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","componentDidMount","sizes","length","console","warn","componentDidUpdate","present","index","dismiss","render","backgroundColor","
|
|
1
|
+
{"version":3,"names":["React","PureComponent","createRef","requireNativeComponent","Platform","findNodeHandle","View","TrueSheetModule","LINKING_ERROR","select","ios","default","ComponentName","TrueSheetNativeView","Error","TrueSheet","displayName","constructor","props","ref","onDismiss","bind","onPresent","onSizeChange","state","scrollableHandle","handle","nodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","componentDidMount","sizes","length","console","warn","componentDidUpdate","present","index","resize","dismiss","render","backgroundColor","grabber","dismissible","blurTint","cornerRadius","maxHeight","FooterComponent","style","contentContainerStyle","children","rest","createElement","$nativeSheet","_extends","collapsable","overflow","undefined","android","borderTopLeftRadius","borderTopRightRadius","position","left","zIndex"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,aAAa,EAA6BC,SAAS,QAAwB,OAAO;AAClG,SACEC,sBAAsB,EACtBC,QAAQ,EACRC,cAAc,EACdC,IAAI,QAIC,cAAc;AAGrB,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,MAAMC,aAAa,GAChB,2FAA0F,GAC3FJ,QAAQ,CAACK,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,aAAa,GAAG,eAAe;AAQrC,MAAMC,mBAAmB,GAAGV,sBAAsB,CAA2BS,aAAa,CAAC;AAE3F,IAAI,CAACC,mBAAmB,EAAE;EACxB,MAAM,IAAIC,KAAK,CAACN,aAAa,CAAC;AAChC;AAQA,OAAO,MAAMO,SAAS,SAASd,aAAa,CAAiC;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QAAS;MACnBC,YAAY,EAAEA,YAAa;MAC3BH,OAAO,EAAEA,OAAQ;MACjBC,WAAW,EAAEA,WAAY;MACzBG,SAAS,EAAEA,SAAU;MACrB5B,SAAS,EAAE,IAAI,CAACA,SAAU;MAC1BF,SAAS,EAAE,IAAI,CAACA,SAAU;MAC1BG,YAAY,EAAE,IAAI,CAACA;IAAa,gBAEhCvB,KAAA,CAAAwD,aAAA,CAAClD,IAAI,EAAAoD,QAAA;MACHC,WAAW,EAAE,KAAM;MACnBP,KAAK,EAAE,CACL;QACEQ,QAAQ,EAAExD,QAAQ,CAACK,MAAM,CAAC;UAAEC,GAAG,EAAEmD,SAAS;UAAEC,OAAO,EAAE;QAAS,CAAC,CAAC;QAChEC,mBAAmB,EAAEd,YAAY;QACjCe,oBAAoB,EAAEf,YAAY;QAElC;QACAJ,eAAe,EAAEzC,QAAQ,CAACK,MAAM,CAAC;UAC/BC,GAAG,EAAEsC,QAAQ,GAAGa,SAAS,GAAGhB,eAAe;UAC3CiB,OAAO,EAAEjB;QACX,CAAC;MACH,CAAC,EACDO,KAAK;IACL,GACEG,IAAI,gBAERvD,KAAA,CAAAwD,aAAA,CAAClD,IAAI;MAACqD,WAAW,EAAE,KAAM;MAACP,KAAK,EAAEC;IAAsB,GACpDC,QACG,CAAC,eACPtD,KAAA,CAAAwD,aAAA,CAAClD,IAAI;MAACqD,WAAW,EAAE;IAAM,GAAE,CAAC,CAACR,eAAe,iBAAInD,KAAA,CAAAwD,aAAA,CAACL,eAAe,MAAE,CAAQ,CACtE,CACa,CAAC;EAE1B;AACF;AAEA,MAAMM,YAAuB,GAAG;EAC9BQ,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,CAAC,IAAI;EACXC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]}
|
|
@@ -15,10 +15,15 @@ export declare class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetSt
|
|
|
15
15
|
componentDidMount(): void;
|
|
16
16
|
componentDidUpdate(): void;
|
|
17
17
|
/**
|
|
18
|
-
* Present the modal sheet
|
|
18
|
+
* Present the modal sheet. Optionally accepts a size `index`.
|
|
19
19
|
* See `sizes` prop
|
|
20
20
|
*/
|
|
21
21
|
present(index?: number): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Resizes the Sheet programmatically by `index`.
|
|
24
|
+
* This is an alias of the `present(index)` method.
|
|
25
|
+
*/
|
|
26
|
+
resize(index: number): Promise<void>;
|
|
22
27
|
/**
|
|
23
28
|
* Dismisses the Sheet
|
|
24
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrueSheet.d.ts","sourceRoot":"","sources":["../../../src/TrueSheet.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAWlG,OAAO,KAAK,EAAE,cAAc,EAAY,MAAM,SAAS,CAAA;AAyBvD,UAAU,cAAc;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC;AAED,qBAAa,SAAU,SAAQ,aAAa,CAAC,cAAc,EAAE,cAAc,CAAC;IAC1E,WAAW,SAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAsB;gBAE9B,KAAK,EAAE,cAAc;IAcjC,OAAO,KAAK,MAAM,GAOjB;IAED,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,SAAS;IAIjB,iBAAiB,IAAI,IAAI;IAUzB,kBAAkB,IAAI,IAAI;IAI1B;;;OAGG;IACU,OAAO,CAAC,KAAK,GAAE,MAAU;
|
|
1
|
+
{"version":3,"file":"TrueSheet.d.ts","sourceRoot":"","sources":["../../../src/TrueSheet.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAWlG,OAAO,KAAK,EAAE,cAAc,EAAY,MAAM,SAAS,CAAA;AAyBvD,UAAU,cAAc;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC;AAED,qBAAa,SAAU,SAAQ,aAAa,CAAC,cAAc,EAAE,cAAc,CAAC;IAC1E,WAAW,SAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAsB;gBAE9B,KAAK,EAAE,cAAc;IAcjC,OAAO,KAAK,MAAM,GAOjB;IAED,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,SAAS;IAIjB,iBAAiB,IAAI,IAAI;IAUzB,kBAAkB,IAAI,IAAI;IAI1B;;;OAGG;IACU,OAAO,CAAC,KAAK,GAAE,MAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD;;;OAGG;IACU,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD;;OAEG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC,MAAM,IAAI,SAAS;CAyDpB"}
|
|
@@ -72,8 +72,16 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
72
72
|
* @default ['medium', 'large']
|
|
73
73
|
*/
|
|
74
74
|
sizes?: SheetSize[];
|
|
75
|
+
/**
|
|
76
|
+
* Prevents interactive dismissal of the Sheet.
|
|
77
|
+
*
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
dismissible?: boolean;
|
|
75
81
|
/**
|
|
76
82
|
* Main sheet background color
|
|
83
|
+
*
|
|
84
|
+
* @default white
|
|
77
85
|
*/
|
|
78
86
|
backgroundColor?: ColorValue;
|
|
79
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAChE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,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IAEtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;CACxC"}
|
package/package.json
CHANGED
package/src/TrueSheet.tsx
CHANGED
|
@@ -66,7 +66,7 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
|
|
|
66
66
|
return nodeHandle
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
private updateState() {
|
|
69
|
+
private updateState(): void {
|
|
70
70
|
const scrollableHandle = this.props.scrollRef?.current
|
|
71
71
|
? findNodeHandle(this.props.scrollRef.current)
|
|
72
72
|
: null
|
|
@@ -76,7 +76,7 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
|
|
|
76
76
|
})
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
private onSizeChange(event: NativeSyntheticEvent<SizeInfo>) {
|
|
79
|
+
private onSizeChange(event: NativeSyntheticEvent<SizeInfo>): void {
|
|
80
80
|
this.props.onSizeChange?.(event.nativeEvent)
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -103,27 +103,36 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
|
-
* Present the modal sheet
|
|
106
|
+
* Present the modal sheet. Optionally accepts a size `index`.
|
|
107
107
|
* See `sizes` prop
|
|
108
108
|
*/
|
|
109
|
-
public async present(index: number = 0) {
|
|
109
|
+
public async present(index: number = 0): Promise<void> {
|
|
110
110
|
await TrueSheetModule.present(this.handle, index)
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Resizes the Sheet programmatically by `index`.
|
|
115
|
+
* This is an alias of the `present(index)` method.
|
|
116
|
+
*/
|
|
117
|
+
public async resize(index: number): Promise<void> {
|
|
118
|
+
await this.present(index)
|
|
119
|
+
}
|
|
120
|
+
|
|
113
121
|
/**
|
|
114
122
|
* Dismisses the Sheet
|
|
115
123
|
*/
|
|
116
|
-
public async dismiss() {
|
|
124
|
+
public async dismiss(): Promise<void> {
|
|
117
125
|
await TrueSheetModule.dismiss(this.handle)
|
|
118
126
|
}
|
|
119
127
|
|
|
120
128
|
render(): ReactNode {
|
|
121
129
|
const {
|
|
122
130
|
sizes,
|
|
123
|
-
backgroundColor,
|
|
131
|
+
backgroundColor = 'white',
|
|
132
|
+
grabber = true,
|
|
133
|
+
dismissible = true,
|
|
124
134
|
blurTint,
|
|
125
135
|
cornerRadius,
|
|
126
|
-
grabber,
|
|
127
136
|
maxHeight,
|
|
128
137
|
FooterComponent,
|
|
129
138
|
style,
|
|
@@ -132,8 +141,6 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
|
|
|
132
141
|
...rest
|
|
133
142
|
} = this.props
|
|
134
143
|
|
|
135
|
-
const wrapperBackgroundColor = backgroundColor ?? 'white'
|
|
136
|
-
|
|
137
144
|
return (
|
|
138
145
|
<TrueSheetNativeView
|
|
139
146
|
ref={this.ref}
|
|
@@ -142,7 +149,8 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
|
|
|
142
149
|
sizes={sizes ?? ['medium', 'large']}
|
|
143
150
|
blurTint={blurTint}
|
|
144
151
|
cornerRadius={cornerRadius}
|
|
145
|
-
grabber={grabber
|
|
152
|
+
grabber={grabber}
|
|
153
|
+
dismissible={dismissible}
|
|
146
154
|
maxHeight={maxHeight}
|
|
147
155
|
onPresent={this.onPresent}
|
|
148
156
|
onDismiss={this.onDismiss}
|
|
@@ -158,8 +166,8 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
|
|
|
158
166
|
|
|
159
167
|
// Remove backgroundColor if `blurTint` is set on iOS
|
|
160
168
|
backgroundColor: Platform.select({
|
|
161
|
-
ios: blurTint ? undefined :
|
|
162
|
-
android:
|
|
169
|
+
ios: blurTint ? undefined : backgroundColor,
|
|
170
|
+
android: backgroundColor,
|
|
163
171
|
}),
|
|
164
172
|
},
|
|
165
173
|
style,
|
package/src/types.ts
CHANGED
|
@@ -103,8 +103,17 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
103
103
|
*/
|
|
104
104
|
sizes?: SheetSize[]
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Prevents interactive dismissal of the Sheet.
|
|
108
|
+
*
|
|
109
|
+
* @default true
|
|
110
|
+
*/
|
|
111
|
+
dismissible?: boolean
|
|
112
|
+
|
|
106
113
|
/**
|
|
107
114
|
* Main sheet background color
|
|
115
|
+
*
|
|
116
|
+
* @default white
|
|
108
117
|
*/
|
|
109
118
|
backgroundColor?: ColorValue
|
|
110
119
|
|