@lodev09/react-native-true-sheet 0.10.2 → 0.11.1
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 +44 -39
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt +63 -6
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +38 -15
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +10 -0
- package/ios/TrueSheet-Bridging-Header.h +3 -0
- package/ios/TrueSheetView.swift +35 -11
- package/ios/TrueSheetViewController.swift +40 -17
- package/ios/TrueSheetViewManager.m +2 -0
- package/lib/commonjs/TrueSheet.js +10 -6
- package/lib/commonjs/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.js +10 -6
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/typescript/src/types.d.ts +16 -0
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/TrueSheet.tsx +11 -11
- package/src/types.ts +18 -0
package/README.md
CHANGED
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
# React Native True Sheet
|
|
2
2
|
|
|
3
3
|
[](https://github.com/lodev09/react-native-true-sheet/actions/workflows/ci.yml)
|
|
4
|
-
](https://www.npmjs.com/package/@lodev09/react-native-true-sheet)
|
|
5
|
+
[](https://www.npmjs.com/package/@lodev09/react-native-true-sheet)
|
|
6
6
|
|
|
7
7
|
The true native bottom sheet experience for your React Native Apps. 💩
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
<img alt="React Native True Sheet" src="docs/static/img/preview.gif" width="600px" />
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* ✅ Handles your _Keyboard_ needs, natively.
|
|
18
|
-
* ✅ Asynchronus `ref` [methods](https://sheet.lodev09.com/reference/methods#ref-methods).
|
|
19
|
-
* ✅ Bonus! [Blur](https://sheet.lodev09.com/reference/types#blurtint) support on IOS 😎
|
|
12
|
+
|
|
13
|
+
* Implemented in the native realm.
|
|
14
|
+
* Clean, fast, and lightweight.
|
|
15
|
+
* Asynchronus `ref` [methods](https://sheet.lodev09.com/reference/methods#ref-methods).
|
|
16
|
+
* Bonus! [Blur](https://sheet.lodev09.com/reference/types#blurtint) support on IOS 😎
|
|
20
17
|
|
|
21
18
|
## Installation
|
|
22
19
|
|
|
20
|
+
You can install the package by using either `yarn` or `npm`.
|
|
21
|
+
|
|
23
22
|
```sh
|
|
24
23
|
yarn add @lodev09/react-native-true-sheet
|
|
25
24
|
```
|
|
26
|
-
|
|
27
25
|
```sh
|
|
28
26
|
npm i @lodev09/react-native-true-sheet
|
|
29
27
|
```
|
|
30
28
|
|
|
29
|
+
Next, run the following to install it on IOS.
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
cd ios && pod install
|
|
33
|
+
```
|
|
34
|
+
|
|
31
35
|
## Documentation
|
|
32
36
|
|
|
33
37
|
- [Guides](https://sheet.lodev09.com/category/guides)
|
|
@@ -39,39 +43,40 @@ npm i @lodev09/react-native-true-sheet
|
|
|
39
43
|
```tsx
|
|
40
44
|
import { TrueSheet } from "@lodev09/react-native-true-sheet"
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
export const App = () => {
|
|
47
|
+
const sheet = useRef<TrueSheet>(null)
|
|
48
|
+
|
|
49
|
+
// Present the sheet ✅
|
|
50
|
+
const present = async () => {
|
|
51
|
+
await sheet.current?.present()
|
|
52
|
+
console.log('horray! sheet has been presented 💩')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Dismiss the sheet ✅
|
|
56
|
+
const dismiss = async () => {
|
|
57
|
+
await sheet.current?.dismiss()
|
|
58
|
+
console.log('Bye bye 👋')
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<View>
|
|
63
|
+
<Button onPress={present} title="Present" />
|
|
64
|
+
<TrueSheet
|
|
65
|
+
ref={sheet}
|
|
66
|
+
sizes={['auto', 'large']}
|
|
67
|
+
cornerRadius={24}
|
|
68
|
+
>
|
|
69
|
+
<Button onPress={dismiss} title="Dismiss" />
|
|
70
|
+
</TrueSheet>
|
|
71
|
+
</View>
|
|
72
|
+
)
|
|
49
73
|
}
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<View>
|
|
53
|
-
<Button onPress={openSheet} title="Open Sheet" />
|
|
54
|
-
<TrueSheet
|
|
55
|
-
ref={sheet}
|
|
56
|
-
sizes={['auto', 'large']}
|
|
57
|
-
cornerRadius={24}
|
|
58
|
-
>
|
|
59
|
-
<View />
|
|
60
|
-
</TrueSheet>
|
|
61
|
-
</View>
|
|
62
|
-
)
|
|
63
74
|
```
|
|
64
75
|
|
|
65
|
-
## v1 Roadmap
|
|
66
|
-
|
|
67
|
-
- [ ] Inline sheet
|
|
68
|
-
- [ ] Test with RN new architecture
|
|
69
|
-
- [ ] Reanimated integration(?)
|
|
70
|
-
|
|
71
76
|
## Contributing
|
|
72
77
|
|
|
73
78
|
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
74
79
|
|
|
75
80
|
## License
|
|
76
81
|
|
|
77
|
-
MIT
|
|
82
|
+
[MIT](LICENSE)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
package com.lodev09.truesheet
|
|
2
2
|
|
|
3
|
+
import android.annotation.SuppressLint
|
|
3
4
|
import android.graphics.Color
|
|
5
|
+
import android.view.View
|
|
4
6
|
import android.view.ViewGroup
|
|
5
7
|
import android.view.WindowManager
|
|
6
8
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
@@ -12,14 +14,30 @@ import com.lodev09.truesheet.core.Utils
|
|
|
12
14
|
|
|
13
15
|
data class SizeInfo(val index: Int, val value: Float)
|
|
14
16
|
|
|
17
|
+
@SuppressLint("ClickableViewAccessibility")
|
|
15
18
|
class TrueSheetDialog(private val reactContext: ThemedReactContext, private val rootSheetView: RootSheetView) :
|
|
16
19
|
BottomSheetDialog(reactContext) {
|
|
17
20
|
|
|
18
21
|
private var keyboardManager = KeyboardManager(reactContext)
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Specify whether the sheet background is dimmed.
|
|
25
|
+
* Set to `false` to allow interaction with the background components.
|
|
26
|
+
*/
|
|
27
|
+
var dimmed = true
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The size index that the sheet should start to dim the background.
|
|
31
|
+
* This is ignored if `dimmed` is set to `false`.
|
|
32
|
+
*/
|
|
33
|
+
var dimmedIndex = 0
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The maximum window height
|
|
37
|
+
*/
|
|
38
|
+
var maxScreenHeight = 0
|
|
39
|
+
var contentHeight = 0
|
|
40
|
+
var footerHeight = 0
|
|
23
41
|
var maxSheetHeight: Int? = null
|
|
24
42
|
|
|
25
43
|
var footerView: ViewGroup? = null
|
|
@@ -45,7 +63,46 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val
|
|
|
45
63
|
maxScreenHeight = Utils.screenHeight(reactContext)
|
|
46
64
|
}
|
|
47
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Setup dimmed sheet.
|
|
68
|
+
* `dimmedIndex` will further customize the dimming behavior.
|
|
69
|
+
*/
|
|
70
|
+
fun setupDimmedBackground(sizeIndex: Int) {
|
|
71
|
+
window?.apply {
|
|
72
|
+
val view = findViewById<View>(com.google.android.material.R.id.touch_outside)
|
|
73
|
+
|
|
74
|
+
if (dimmed && sizeIndex >= dimmedIndex) {
|
|
75
|
+
// Remove touch listener
|
|
76
|
+
view.setOnTouchListener(null)
|
|
77
|
+
|
|
78
|
+
// Add the dimmed background
|
|
79
|
+
setFlags(
|
|
80
|
+
WindowManager.LayoutParams.FLAG_DIM_BEHIND,
|
|
81
|
+
WindowManager.LayoutParams.FLAG_DIM_BEHIND
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
setCanceledOnTouchOutside(true)
|
|
85
|
+
} else {
|
|
86
|
+
// Override the background touch and pass it to the components outside
|
|
87
|
+
view.setOnTouchListener { v, event ->
|
|
88
|
+
event.setLocation(event.rawX - v.x, event.rawY - v.y)
|
|
89
|
+
reactContext.currentActivity?.dispatchTouchEvent(event)
|
|
90
|
+
false
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Remove the dimmed background
|
|
94
|
+
clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
|
95
|
+
|
|
96
|
+
setCanceledOnTouchOutside(false)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Present the sheet.
|
|
103
|
+
*/
|
|
48
104
|
fun show(sizeIndex: Int) {
|
|
105
|
+
setupDimmedBackground(sizeIndex)
|
|
49
106
|
if (isShowing) {
|
|
50
107
|
setStateForSizeIndex(sizeIndex)
|
|
51
108
|
} else {
|
|
@@ -63,7 +120,7 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val
|
|
|
63
120
|
}
|
|
64
121
|
|
|
65
122
|
/**
|
|
66
|
-
* Set the state based
|
|
123
|
+
* Set the state based for the given size index.
|
|
67
124
|
*/
|
|
68
125
|
private fun setStateForSizeIndex(index: Int) {
|
|
69
126
|
behavior.state = getStateForSizeIndex(index)
|
|
@@ -119,7 +176,7 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val
|
|
|
119
176
|
}
|
|
120
177
|
|
|
121
178
|
/**
|
|
122
|
-
* Determines the state based
|
|
179
|
+
* Determines the state based from the given size index.
|
|
123
180
|
*/
|
|
124
181
|
private fun getStateForSizeIndex(index: Int) =
|
|
125
182
|
when (sizes.size) {
|
|
@@ -170,7 +227,7 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val
|
|
|
170
227
|
}
|
|
171
228
|
|
|
172
229
|
/**
|
|
173
|
-
* Configure the sheet based
|
|
230
|
+
* Configure the sheet based from the size preference.
|
|
174
231
|
*/
|
|
175
232
|
fun configure() {
|
|
176
233
|
// Configure sheet sizes
|
|
@@ -30,7 +30,7 @@ class TrueSheetView(context: Context) :
|
|
|
30
30
|
/**
|
|
31
31
|
* Current activeIndex.
|
|
32
32
|
*/
|
|
33
|
-
private var
|
|
33
|
+
private var currentSizeIndex: Int = 0
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Promise callback to be invoked after `present` is called.
|
|
@@ -77,19 +77,21 @@ class TrueSheetView(context: Context) :
|
|
|
77
77
|
positionFooter()
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
// Resolve the present promise
|
|
80
81
|
presentPromise?.let { promise ->
|
|
81
82
|
promise()
|
|
82
83
|
presentPromise = null
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
// dispatch onPresent event
|
|
86
|
-
eventDispatcher?.dispatchEvent(PresentEvent(surfaceId, id, sheetDialog.getSizeInfoForIndex(
|
|
87
|
+
eventDispatcher?.dispatchEvent(PresentEvent(surfaceId, id, sheetDialog.getSizeInfoForIndex(currentSizeIndex)))
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
// Setup listener when the dialog has been dismissed.
|
|
90
91
|
setOnDismissListener {
|
|
91
92
|
unregisterKeyboardManager()
|
|
92
93
|
|
|
94
|
+
// Resolve the dismiss promise
|
|
93
95
|
dismissPromise?.let { promise ->
|
|
94
96
|
promise()
|
|
95
97
|
dismissPromise = null
|
|
@@ -106,27 +108,32 @@ class TrueSheetView(context: Context) :
|
|
|
106
108
|
footerView?.let {
|
|
107
109
|
val y = (maxScreenHeight - sheetView.top - footerHeight).toFloat()
|
|
108
110
|
if (slideOffset >= 0) {
|
|
111
|
+
// Sheet is expanding
|
|
109
112
|
it.y = y
|
|
110
113
|
} else {
|
|
114
|
+
// Sheet is collapsing
|
|
111
115
|
it.y = y - footerHeight * slideOffset
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
override fun onStateChanged(view: View, newState: Int) {
|
|
117
|
-
|
|
118
|
-
if (sizeInfo != null && sizeInfo.index != activeIndex) {
|
|
119
|
-
// Invoke promise when sheet resized programmatically
|
|
120
|
-
presentPromise?.let { promise ->
|
|
121
|
-
promise()
|
|
122
|
-
presentPromise = null
|
|
123
|
-
}
|
|
121
|
+
if (!isShowing) return
|
|
124
122
|
|
|
125
|
-
|
|
123
|
+
val sizeInfo = getSizeInfoForState(newState)
|
|
124
|
+
if (sizeInfo == null || sizeInfo.index == currentSizeIndex) return
|
|
126
125
|
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
// Invoke promise when sheet resized programmatically
|
|
127
|
+
presentPromise?.let { promise ->
|
|
128
|
+
promise()
|
|
129
|
+
presentPromise = null
|
|
129
130
|
}
|
|
131
|
+
|
|
132
|
+
currentSizeIndex = sizeInfo.index
|
|
133
|
+
setupDimmedBackground(sizeInfo.index)
|
|
134
|
+
|
|
135
|
+
// dispatch onSizeChange event
|
|
136
|
+
eventDispatcher?.dispatchEvent(SizeChangeEvent(surfaceId, id, sizeInfo))
|
|
130
137
|
}
|
|
131
138
|
}
|
|
132
139
|
)
|
|
@@ -231,8 +238,21 @@ class TrueSheetView(context: Context) :
|
|
|
231
238
|
configureIfShowing()
|
|
232
239
|
}
|
|
233
240
|
|
|
241
|
+
fun setDimmed(dimmed: Boolean) {
|
|
242
|
+
sheetDialog.dimmed = dimmed
|
|
243
|
+
if (sheetDialog.isShowing) {
|
|
244
|
+
sheetDialog.setupDimmedBackground(currentSizeIndex)
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
fun setDimmedIndex(index: Int) {
|
|
249
|
+
sheetDialog.dimmedIndex = index
|
|
250
|
+
if (sheetDialog.isShowing) {
|
|
251
|
+
sheetDialog.setupDimmedBackground(currentSizeIndex)
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
234
255
|
fun setDismissible(dismissible: Boolean) {
|
|
235
|
-
sheetDialog.behavior.isHideable = dismissible
|
|
236
256
|
sheetDialog.setCancelable(dismissible)
|
|
237
257
|
}
|
|
238
258
|
|
|
@@ -246,7 +266,7 @@ class TrueSheetView(context: Context) :
|
|
|
246
266
|
*/
|
|
247
267
|
fun present(sizeIndex: Int, promiseCallback: () -> Unit) {
|
|
248
268
|
if (!sheetDialog.isShowing) {
|
|
249
|
-
|
|
269
|
+
currentSizeIndex = sizeIndex
|
|
250
270
|
}
|
|
251
271
|
|
|
252
272
|
presentPromise = promiseCallback
|
|
@@ -258,7 +278,10 @@ class TrueSheetView(context: Context) :
|
|
|
258
278
|
*/
|
|
259
279
|
fun dismiss(promiseCallback: () -> Unit) {
|
|
260
280
|
dismissPromise = promiseCallback
|
|
261
|
-
|
|
281
|
+
|
|
282
|
+
// Note: We are not calling `sheetDialog.dismiss()` here.
|
|
283
|
+
// This is to properly set the behavior state.
|
|
284
|
+
sheetDialog.behavior.state = BottomSheetBehavior.STATE_HIDDEN
|
|
262
285
|
}
|
|
263
286
|
|
|
264
287
|
companion object {
|
|
@@ -39,6 +39,16 @@ class TrueSheetViewManager : ViewGroupManager<TrueSheetView>() {
|
|
|
39
39
|
view.setDismissible(dismissible)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
@ReactProp(name = "dimmed")
|
|
43
|
+
fun setDimmed(view: TrueSheetView, dimmed: Boolean) {
|
|
44
|
+
view.setDimmed(dimmed)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@ReactProp(name = "dimmedIndex")
|
|
48
|
+
fun setDimmedIndex(view: TrueSheetView, index: Int) {
|
|
49
|
+
view.setDimmedIndex(index)
|
|
50
|
+
}
|
|
51
|
+
|
|
42
52
|
@ReactProp(name = "contentHeight")
|
|
43
53
|
fun setContentHeight(view: TrueSheetView, height: Double) {
|
|
44
54
|
view.setContentHeight(Utils.toPixel(height))
|
package/ios/TrueSheetView.swift
CHANGED
|
@@ -172,7 +172,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
172
172
|
@objc
|
|
173
173
|
func setMaxHeight(_ height: NSNumber) {
|
|
174
174
|
viewController.maxHeight = CGFloat(height.floatValue)
|
|
175
|
-
|
|
175
|
+
configurePresentedSheet()
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
@objc
|
|
@@ -182,7 +182,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
182
182
|
let bottomInset = window?.safeAreaInsets.bottom ?? 0
|
|
183
183
|
|
|
184
184
|
viewController.contentHeight = CGFloat(height.floatValue) - bottomInset
|
|
185
|
-
|
|
185
|
+
configurePresentedSheet()
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
@objc
|
|
@@ -201,13 +201,13 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
201
201
|
footerViewHeightConstraint.constant = 0
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
configurePresentedSheet()
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
@objc
|
|
208
208
|
func setSizes(_ sizes: [Any]) {
|
|
209
209
|
viewController.sizes = Array(sizes.prefix(3))
|
|
210
|
-
|
|
210
|
+
configurePresentedSheet()
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
@objc
|
|
@@ -229,7 +229,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
229
229
|
|
|
230
230
|
viewController.cornerRadius = cornerRadius
|
|
231
231
|
if #available(iOS 15.0, *) {
|
|
232
|
-
|
|
232
|
+
withPresentedSheet { sheet in
|
|
233
233
|
sheet.preferredCornerRadius = viewController.cornerRadius
|
|
234
234
|
}
|
|
235
235
|
}
|
|
@@ -239,12 +239,34 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
239
239
|
func setGrabber(_ visible: Bool) {
|
|
240
240
|
viewController.grabber = visible
|
|
241
241
|
if #available(iOS 15.0, *) {
|
|
242
|
-
|
|
242
|
+
withPresentedSheet { sheet in
|
|
243
243
|
sheet.prefersGrabberVisible = visible
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
+
@objc
|
|
249
|
+
func setDimmed(_ dimmed: Bool) {
|
|
250
|
+
viewController.dimmed = dimmed
|
|
251
|
+
|
|
252
|
+
if #available(iOS 15.0, *) {
|
|
253
|
+
withPresentedSheet { sheet in
|
|
254
|
+
viewController.setupDimmedBackground(for: sheet)
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
@objc
|
|
260
|
+
func setDimmedIndex(_ index: NSNumber) {
|
|
261
|
+
viewController.dimmedIndex = index as? Int
|
|
262
|
+
|
|
263
|
+
if #available(iOS 15.0, *) {
|
|
264
|
+
withPresentedSheet { sheet in
|
|
265
|
+
viewController.setupDimmedBackground(for: sheet)
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
248
270
|
@objc
|
|
249
271
|
func setScrollableHandle(_ tag: NSNumber?) {
|
|
250
272
|
let view = bridge.uiManager.view(forReactTag: tag) as? RCTScrollView
|
|
@@ -261,18 +283,20 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
261
283
|
return ["index": sizeInfo.index, "value": sizeInfo.value]
|
|
262
284
|
}
|
|
263
285
|
|
|
264
|
-
/// Use to customize some properties of the Sheet
|
|
286
|
+
/// Use to customize some properties of the Sheet without fully reconfiguring.
|
|
265
287
|
@available(iOS 15.0, *)
|
|
266
|
-
func
|
|
288
|
+
func withPresentedSheet(completion: (UISheetPresentationController) -> Void) {
|
|
267
289
|
guard isPresented, let sheet = viewController.sheetPresentationController else {
|
|
268
290
|
return
|
|
269
291
|
}
|
|
270
292
|
|
|
271
|
-
|
|
293
|
+
sheet.animateChanges {
|
|
294
|
+
completion(sheet)
|
|
295
|
+
}
|
|
272
296
|
}
|
|
273
297
|
|
|
274
|
-
///
|
|
275
|
-
func
|
|
298
|
+
/// Fully reconfigure the sheet. Use during size prop changes.
|
|
299
|
+
func configurePresentedSheet() {
|
|
276
300
|
if isPresented {
|
|
277
301
|
viewController.configureSheet(at: activeIndex ?? 0, nil)
|
|
278
302
|
}
|
|
@@ -43,6 +43,8 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
|
|
|
43
43
|
|
|
44
44
|
var cornerRadius: CGFloat?
|
|
45
45
|
var grabber = true
|
|
46
|
+
var dimmed = true
|
|
47
|
+
var dimmedIndex: Int? = 0
|
|
46
48
|
|
|
47
49
|
// MARK: - Setup
|
|
48
50
|
|
|
@@ -126,6 +128,25 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
|
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
|
|
131
|
+
/// Setup dimmed sheet.
|
|
132
|
+
/// `dimmedIndex` will further customize the dimming behavior.
|
|
133
|
+
@available(iOS 15.0, *)
|
|
134
|
+
func setupDimmedBackground(for sheet: UISheetPresentationController) {
|
|
135
|
+
if dimmed, dimmedIndex == 0 {
|
|
136
|
+
sheet.largestUndimmedDetentIdentifier = nil
|
|
137
|
+
} else {
|
|
138
|
+
sheet.largestUndimmedDetentIdentifier = .large
|
|
139
|
+
|
|
140
|
+
if #available(iOS 16.0, *) {
|
|
141
|
+
if dimmed, let dimmedIndex, sheet.detents.indices.contains(dimmedIndex - 1) {
|
|
142
|
+
sheet.largestUndimmedDetentIdentifier = sheet.detents[dimmedIndex - 1].identifier
|
|
143
|
+
} else if let lastIdentifier = sheet.detents.last?.identifier {
|
|
144
|
+
sheet.largestUndimmedDetentIdentifier = lastIdentifier
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
129
150
|
/// Prepares the view controller for sheet presentation
|
|
130
151
|
func configureSheet(at index: Int = 0, _ completion: ((SizeInfo) -> Void)?) {
|
|
131
152
|
let defaultSizeInfo = SizeInfo(index: index, value: view.bounds.height)
|
|
@@ -147,26 +168,28 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
|
|
|
147
168
|
detents.append(detent)
|
|
148
169
|
}
|
|
149
170
|
|
|
150
|
-
sheet.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
171
|
+
sheet.animateChanges {
|
|
172
|
+
sheet.detents = detents
|
|
173
|
+
sheet.prefersEdgeAttachedInCompactHeight = true
|
|
174
|
+
sheet.prefersGrabberVisible = grabber
|
|
175
|
+
sheet.preferredCornerRadius = cornerRadius
|
|
176
|
+
sheet.delegate = self
|
|
177
|
+
|
|
178
|
+
var identifier: UISheetPresentationController.Detent.Identifier = .medium
|
|
179
|
+
|
|
180
|
+
if sheet.detents.indices.contains(index) {
|
|
181
|
+
let detent = sheet.detents[index]
|
|
182
|
+
if #available(iOS 16.0, *) {
|
|
183
|
+
identifier = detent.identifier
|
|
184
|
+
} else if detent == .large() {
|
|
185
|
+
identifier = .large
|
|
186
|
+
}
|
|
164
187
|
}
|
|
165
|
-
}
|
|
166
188
|
|
|
167
|
-
|
|
189
|
+
setupDimmedBackground(for: sheet)
|
|
190
|
+
|
|
168
191
|
sheet.selectedDetentIdentifier = identifier
|
|
169
|
-
completion?(
|
|
192
|
+
completion?(detentValues[identifier.rawValue] ?? defaultSizeInfo)
|
|
170
193
|
}
|
|
171
194
|
}
|
|
172
195
|
}
|
|
@@ -35,6 +35,8 @@ RCT_EXPORT_VIEW_PROPERTY(blurTint, NSString)
|
|
|
35
35
|
RCT_EXPORT_VIEW_PROPERTY(cornerRadius, NSNumber)
|
|
36
36
|
RCT_EXPORT_VIEW_PROPERTY(grabber, BOOL)
|
|
37
37
|
RCT_EXPORT_VIEW_PROPERTY(dismissible, BOOL)
|
|
38
|
+
RCT_EXPORT_VIEW_PROPERTY(dimmed, BOOL)
|
|
39
|
+
RCT_EXPORT_VIEW_PROPERTY(dimmedIndex, NSNumber)
|
|
38
40
|
|
|
39
41
|
// Internal properties
|
|
40
42
|
RCT_EXPORT_VIEW_PROPERTY(contentHeight, NSNumber)
|
|
@@ -99,14 +99,14 @@ class TrueSheet extends _react.PureComponent {
|
|
|
99
99
|
onPresent(event) {
|
|
100
100
|
this.props.onPresent?.(event.nativeEvent);
|
|
101
101
|
}
|
|
102
|
-
onFooterLayout(
|
|
102
|
+
onFooterLayout(event) {
|
|
103
103
|
this.setState({
|
|
104
|
-
footerHeight: layout.height
|
|
104
|
+
footerHeight: event.nativeEvent.layout.height
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
onContentLayout(
|
|
107
|
+
onContentLayout(event) {
|
|
108
108
|
this.setState({
|
|
109
|
-
contentHeight: layout.height
|
|
109
|
+
contentHeight: event.nativeEvent.layout.height
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
onDismiss() {
|
|
@@ -150,6 +150,8 @@ class TrueSheet extends _react.PureComponent {
|
|
|
150
150
|
backgroundColor = 'white',
|
|
151
151
|
dismissible = true,
|
|
152
152
|
grabber = true,
|
|
153
|
+
dimmed = true,
|
|
154
|
+
dimmedIndex,
|
|
153
155
|
grabberProps,
|
|
154
156
|
blurTint,
|
|
155
157
|
cornerRadius,
|
|
@@ -170,6 +172,8 @@ class TrueSheet extends _react.PureComponent {
|
|
|
170
172
|
contentHeight: this.state.contentHeight,
|
|
171
173
|
footerHeight: this.state.footerHeight,
|
|
172
174
|
grabber: grabber,
|
|
175
|
+
dimmed: dimmed,
|
|
176
|
+
dimmedIndex: dimmedIndex,
|
|
173
177
|
dismissible: dismissible,
|
|
174
178
|
maxHeight: maxHeight,
|
|
175
179
|
onPresent: this.onPresent,
|
|
@@ -192,11 +196,11 @@ class TrueSheet extends _react.PureComponent {
|
|
|
192
196
|
}, style]
|
|
193
197
|
}, rest), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
194
198
|
collapsable: false,
|
|
195
|
-
onLayout:
|
|
199
|
+
onLayout: this.onContentLayout,
|
|
196
200
|
style: contentContainerStyle
|
|
197
201
|
}, children), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
198
202
|
collapsable: false,
|
|
199
|
-
onLayout:
|
|
203
|
+
onLayout: this.onFooterLayout
|
|
200
204
|
}, /*#__PURE__*/_react.default.createElement(_TrueSheetFooter.TrueSheetFooter, {
|
|
201
205
|
Component: FooterComponent
|
|
202
206
|
})), _reactNative.Platform.OS === 'android' && /*#__PURE__*/_react.default.createElement(_TrueSheetGrabber.TrueSheetGrabber, _extends({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_TrueSheetModule","_TrueSheetGrabber","_TrueSheetFooter","_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","NATIVE_COMPONENT_NAME","LINKING_ERROR","Platform","select","ios","TrueSheetNativeView","requireNativeComponent","Error","TrueSheet","PureComponent","displayName","handles","constructor","props","ref","createRef","onDismiss","onPresent","onSizeChange","onContentLayout","onFooterLayout","state","contentHeight","undefined","footerHeight","scrollableHandle","getHandle","name","handle","console","warn","present","index","TrueSheetModule","dismiss","resize","nodeHandle","findNodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","layout","height","componentDidMount","sizes","componentDidUpdate","render","backgroundColor","dismissible","grabber","grabberProps","blurTint","cornerRadius","maxHeight","FooterComponent","style","contentContainerStyle","children","rest","createElement","$nativeSheet","View","collapsable","overflow","android","borderTopLeftRadius","borderTopRightRadius","onL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AAY,EAAEK,KAAa,EAAE;IACtD,MAAMxB,SAAS,CAACuB,OAAO,CAACJ,IAAI,EAAEK,KAAK,CAAC;EACtC;EAEA,IAAYJ,MAAMA,CAAA,EAAW;IAC3B,MAAMQ,UAAU,GAAG,IAAAC,2BAAc,EAAC,IAAI,CAACvB,GAAG,CAACwB,OAAO,CAAC;IACnD,IAAIF,UAAU,IAAI,IAAI,IAAIA,UAAU,KAAK,CAAC,CAAC,EAAE;MAC3C,MAAM,IAAI7B,KAAK,CAAC,+BAA+B,CAAC;IAClD;IAEA,OAAO6B,UAAU;EACnB;EAEQG,WAAWA,CAAA,EAAS;IAC1B,MAAMd,gBAAgB,GAAG,IAAI,CAACZ,KAAK,CAAC2B,SAAS,EAAEF,OAAO,GAClD,IAAAD,2BAAc,EAAC,IAAI,CAACxB,KAAK,CAAC2B,SAAS,CAACF,OAAO,CAAC,GAC5C,IAAI;IAER,IAAI,IAAI,CAACzB,KAAK,CAACc,IAAI,EAAE;MACnBnB,SAAS,CAACG,OAAO,CAAC,IAAI,CAACE,KAAK,CAACc,IAAI,CAAC,GAAG,IAAI,CAACC,MAAM;IAClD;IAEA,IAAI,CAACa,QAAQ,CAAC;MACZhB;IACF,CAAC,CAAC;EACJ;EAEQP,YAAYA,CAACwB,KAAqC,EAAQ;IAChE,IAAI,CAAC7B,KAAK,CAACK,YAAY,GAAGwB,KAAK,CAACC,WAAW,CAAC;EAC9C;EAEQ1B,SAASA,CAACyB,KAAqC,EAAQ;IAC7D,IAAI,CAAC7B,KAAK,CAACI,SAAS,GAAGyB,KAAK,CAACC,WAAW,CAAC;EAC3C;EAEQvB,cAAcA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_TrueSheetModule","_TrueSheetGrabber","_TrueSheetFooter","_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","NATIVE_COMPONENT_NAME","LINKING_ERROR","Platform","select","ios","TrueSheetNativeView","requireNativeComponent","Error","TrueSheet","PureComponent","displayName","handles","constructor","props","ref","createRef","onDismiss","onPresent","onSizeChange","onContentLayout","onFooterLayout","state","contentHeight","undefined","footerHeight","scrollableHandle","getHandle","name","handle","console","warn","present","index","TrueSheetModule","dismiss","resize","nodeHandle","findNodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","layout","height","componentDidMount","sizes","componentDidUpdate","render","backgroundColor","dismissible","grabber","dimmed","dimmedIndex","grabberProps","blurTint","cornerRadius","maxHeight","FooterComponent","style","contentContainerStyle","children","rest","createElement","$nativeSheet","View","collapsable","overflow","android","borderTopLeftRadius","borderTopRightRadius","onLayout","TrueSheetFooter","Component","OS","TrueSheetGrabber","visible","exports","position","left","zIndex"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAYA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAAmD,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAA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EC,GAAG,EAAEmB,SAAS;UAAE8C,OAAO,EAAE;QAAS,CAAC,CAAC;QAChEC,mBAAmB,EAAEb,YAAY;QACjCc,oBAAoB,EAAEd,YAAY;QAElC;QACAP,eAAe,EAAEhD,qBAAQ,CAACC,MAAM,CAAC;UAC/BC,GAAG,EAAEoD,QAAQ,GAAGjC,SAAS,GAAG2B,eAAe;UAC3CmB,OAAO,EAAEnB;QACX,CAAC;MACH,CAAC,EACDU,KAAK;IACL,GACEG,IAAI,gBAERpG,MAAA,CAAAa,OAAA,CAAAwF,aAAA,CAAClG,YAAA,CAAAoG,IAAI;MAACC,WAAW,EAAE,KAAM;MAACK,QAAQ,EAAE,IAAI,CAACrD,eAAgB;MAACyC,KAAK,EAAEC;IAAsB,GACpFC,QACG,CAAC,eACPnG,MAAA,CAAAa,OAAA,CAAAwF,aAAA,CAAClG,YAAA,CAAAoG,IAAI;MAACC,WAAW,EAAE,KAAM;MAACK,QAAQ,EAAE,IAAI,CAACpD;IAAe,gBACtDzD,MAAA,CAAAa,OAAA,CAAAwF,aAAA,CAAC/F,gBAAA,CAAAwG,eAAe;MAACC,SAAS,EAAEf;IAAgB,CAAE,CAC1C,CAAC,EACNzD,qBAAQ,CAACyE,EAAE,KAAK,SAAS,iBAAIhH,MAAA,CAAAa,OAAA,CAAAwF,aAAA,CAAChG,iBAAA,CAAA4G,gBAAgB,EAAArF,QAAA;MAACsF,OAAO,EAAEzB;IAAQ,GAAKG,YAAY,CAAG,CACjF,CACa,CAAC;EAE1B;AACF;AAACuB,OAAA,CAAAtE,SAAA,GAAAA,SAAA;AAED,MAAMyD,YAAuB,GAAG;EAC9Bc,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,CAAC,IAAI;EACXC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]}
|
package/lib/module/TrueSheet.js
CHANGED
|
@@ -91,14 +91,14 @@ export class TrueSheet extends PureComponent {
|
|
|
91
91
|
onPresent(event) {
|
|
92
92
|
this.props.onPresent?.(event.nativeEvent);
|
|
93
93
|
}
|
|
94
|
-
onFooterLayout(
|
|
94
|
+
onFooterLayout(event) {
|
|
95
95
|
this.setState({
|
|
96
|
-
footerHeight: layout.height
|
|
96
|
+
footerHeight: event.nativeEvent.layout.height
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
onContentLayout(
|
|
99
|
+
onContentLayout(event) {
|
|
100
100
|
this.setState({
|
|
101
|
-
contentHeight: layout.height
|
|
101
|
+
contentHeight: event.nativeEvent.layout.height
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
onDismiss() {
|
|
@@ -142,6 +142,8 @@ export class TrueSheet extends PureComponent {
|
|
|
142
142
|
backgroundColor = 'white',
|
|
143
143
|
dismissible = true,
|
|
144
144
|
grabber = true,
|
|
145
|
+
dimmed = true,
|
|
146
|
+
dimmedIndex,
|
|
145
147
|
grabberProps,
|
|
146
148
|
blurTint,
|
|
147
149
|
cornerRadius,
|
|
@@ -162,6 +164,8 @@ export class TrueSheet extends PureComponent {
|
|
|
162
164
|
contentHeight: this.state.contentHeight,
|
|
163
165
|
footerHeight: this.state.footerHeight,
|
|
164
166
|
grabber: grabber,
|
|
167
|
+
dimmed: dimmed,
|
|
168
|
+
dimmedIndex: dimmedIndex,
|
|
165
169
|
dismissible: dismissible,
|
|
166
170
|
maxHeight: maxHeight,
|
|
167
171
|
onPresent: this.onPresent,
|
|
@@ -184,11 +188,11 @@ export class TrueSheet extends PureComponent {
|
|
|
184
188
|
}, style]
|
|
185
189
|
}, rest), /*#__PURE__*/React.createElement(View, {
|
|
186
190
|
collapsable: false,
|
|
187
|
-
onLayout:
|
|
191
|
+
onLayout: this.onContentLayout,
|
|
188
192
|
style: contentContainerStyle
|
|
189
193
|
}, children), /*#__PURE__*/React.createElement(View, {
|
|
190
194
|
collapsable: false,
|
|
191
|
-
onLayout:
|
|
195
|
+
onLayout: this.onFooterLayout
|
|
192
196
|
}, /*#__PURE__*/React.createElement(TrueSheetFooter, {
|
|
193
197
|
Component: FooterComponent
|
|
194
198
|
})), Platform.OS === 'android' && /*#__PURE__*/React.createElement(TrueSheetGrabber, _extends({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","PureComponent","createRef","requireNativeComponent","Platform","findNodeHandle","View","TrueSheetModule","TrueSheetGrabber","TrueSheetFooter","NATIVE_COMPONENT_NAME","LINKING_ERROR","select","ios","default","TrueSheetNativeView","Error","TrueSheet","displayName","handles","constructor","props","ref","onDismiss","bind","onPresent","onSizeChange","onContentLayout","onFooterLayout","state","contentHeight","undefined","footerHeight","scrollableHandle","getHandle","name","handle","console","warn","present","index","dismiss","resize","nodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","layout","height","componentDidMount","sizes","length","componentDidUpdate","render","backgroundColor","dismissible","grabber","grabberProps","blurTint","cornerRadius","maxHeight","FooterComponent","style","contentContainerStyle","children","rest","createElement","$nativeSheet","_extends","collapsable","overflow","android","borderTopLeftRadius","borderTopRightRadius","onLayout","
|
|
1
|
+
{"version":3,"names":["React","PureComponent","createRef","requireNativeComponent","Platform","findNodeHandle","View","TrueSheetModule","TrueSheetGrabber","TrueSheetFooter","NATIVE_COMPONENT_NAME","LINKING_ERROR","select","ios","default","TrueSheetNativeView","Error","TrueSheet","displayName","handles","constructor","props","ref","onDismiss","bind","onPresent","onSizeChange","onContentLayout","onFooterLayout","state","contentHeight","undefined","footerHeight","scrollableHandle","getHandle","name","handle","console","warn","present","index","dismiss","resize","nodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","layout","height","componentDidMount","sizes","length","componentDidUpdate","render","backgroundColor","dismissible","grabber","dimmed","dimmedIndex","grabberProps","blurTint","cornerRadius","maxHeight","FooterComponent","style","contentContainerStyle","children","rest","createElement","$nativeSheet","_extends","collapsable","overflow","android","borderTopLeftRadius","borderTopRightRadius","onLayout","Component","OS","visible","position","left","zIndex"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,aA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MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]}
|
|
@@ -88,6 +88,22 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
88
88
|
* @default ['medium', 'large']
|
|
89
89
|
*/
|
|
90
90
|
sizes?: SheetSize[];
|
|
91
|
+
/**
|
|
92
|
+
* Specify whether the sheet background is dimmed.
|
|
93
|
+
* Set to `false` to allow interaction with the background components.
|
|
94
|
+
*
|
|
95
|
+
* @platform android
|
|
96
|
+
* @platform ios 15+
|
|
97
|
+
* @default true
|
|
98
|
+
*/
|
|
99
|
+
dimmed?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* The size index that the sheet should start to dim the background.
|
|
102
|
+
* This is ignored if `dimmed` is set to `false`.
|
|
103
|
+
*
|
|
104
|
+
* @default 0
|
|
105
|
+
*/
|
|
106
|
+
dimmedIndex?: number;
|
|
91
107
|
/**
|
|
92
108
|
* Prevents interactive dismissal of the Sheet.
|
|
93
109
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAE/D,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAChB,OAAO,GACP,MAAM,GACN,SAAS,GACT,YAAY,GACZ,SAAS,GACT,WAAW,GACX,yBAAyB,GACzB,oBAAoB,GACpB,gBAAgB,GAChB,qBAAqB,GACrB,sBAAsB,GACtB,8BAA8B,GAC9B,yBAAyB,GACzB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;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB;;;;OAIG;IACH,eAAe,CAAC,EAAE,UAAU,CAAA;IAE5B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAA;IAEpC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;IAEnB;;OAEG;IACH,qBAAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAE5C;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAEzC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,YAAY,CAAA;IAEvD;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;IAEpC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IAEtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;CACxC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lodev09/react-native-true-sheet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "The true native bottom sheet experience for your React Native Apps.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"type": "git",
|
|
49
49
|
"url": "git+https://github.com/lodev09/react-native-true-sheet.git"
|
|
50
50
|
},
|
|
51
|
-
"author": "
|
|
51
|
+
"author": "Jovanni Lo <lodev09@gmail.com> (https://github.com/lodev09)",
|
|
52
52
|
"license": "MIT",
|
|
53
53
|
"bugs": {
|
|
54
54
|
"url": "https://github.com/lodev09/react-native-true-sheet/issues"
|
|
55
55
|
},
|
|
56
|
-
"homepage": "https://
|
|
56
|
+
"homepage": "https://sheet.lodev09.com",
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"registry": "https://registry.npmjs.org/"
|
|
59
59
|
},
|
package/src/TrueSheet.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type NativeMethods,
|
|
8
8
|
type ViewStyle,
|
|
9
9
|
type NativeSyntheticEvent,
|
|
10
|
-
type
|
|
10
|
+
type LayoutChangeEvent,
|
|
11
11
|
} from 'react-native'
|
|
12
12
|
|
|
13
13
|
import type { TrueSheetProps, SizeInfo } from './types'
|
|
@@ -143,15 +143,15 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
|
|
|
143
143
|
this.props.onPresent?.(event.nativeEvent)
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
private onFooterLayout(
|
|
146
|
+
private onFooterLayout(event: LayoutChangeEvent): void {
|
|
147
147
|
this.setState({
|
|
148
|
-
footerHeight: layout.height,
|
|
148
|
+
footerHeight: event.nativeEvent.layout.height,
|
|
149
149
|
})
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
private onContentLayout(
|
|
152
|
+
private onContentLayout(event: LayoutChangeEvent): void {
|
|
153
153
|
this.setState({
|
|
154
|
-
contentHeight: layout.height,
|
|
154
|
+
contentHeight: event.nativeEvent.layout.height,
|
|
155
155
|
})
|
|
156
156
|
}
|
|
157
157
|
|
|
@@ -202,6 +202,8 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
|
|
|
202
202
|
backgroundColor = 'white',
|
|
203
203
|
dismissible = true,
|
|
204
204
|
grabber = true,
|
|
205
|
+
dimmed = true,
|
|
206
|
+
dimmedIndex,
|
|
205
207
|
grabberProps,
|
|
206
208
|
blurTint,
|
|
207
209
|
cornerRadius,
|
|
@@ -224,6 +226,8 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
|
|
|
224
226
|
contentHeight={this.state.contentHeight}
|
|
225
227
|
footerHeight={this.state.footerHeight}
|
|
226
228
|
grabber={grabber}
|
|
229
|
+
dimmed={dimmed}
|
|
230
|
+
dimmedIndex={dimmedIndex}
|
|
227
231
|
dismissible={dismissible}
|
|
228
232
|
maxHeight={maxHeight}
|
|
229
233
|
onPresent={this.onPresent}
|
|
@@ -248,14 +252,10 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
|
|
|
248
252
|
]}
|
|
249
253
|
{...rest}
|
|
250
254
|
>
|
|
251
|
-
<View
|
|
252
|
-
collapsable={false}
|
|
253
|
-
onLayout={(e) => this.onContentLayout(e.nativeEvent.layout)}
|
|
254
|
-
style={contentContainerStyle}
|
|
255
|
-
>
|
|
255
|
+
<View collapsable={false} onLayout={this.onContentLayout} style={contentContainerStyle}>
|
|
256
256
|
{children}
|
|
257
257
|
</View>
|
|
258
|
-
<View collapsable={false} onLayout={
|
|
258
|
+
<View collapsable={false} onLayout={this.onFooterLayout}>
|
|
259
259
|
<TrueSheetFooter Component={FooterComponent} />
|
|
260
260
|
</View>
|
|
261
261
|
{Platform.OS === 'android' && <TrueSheetGrabber visible={grabber} {...grabberProps} />}
|
package/src/types.ts
CHANGED
|
@@ -120,6 +120,24 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
120
120
|
*/
|
|
121
121
|
sizes?: SheetSize[]
|
|
122
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Specify whether the sheet background is dimmed.
|
|
125
|
+
* Set to `false` to allow interaction with the background components.
|
|
126
|
+
*
|
|
127
|
+
* @platform android
|
|
128
|
+
* @platform ios 15+
|
|
129
|
+
* @default true
|
|
130
|
+
*/
|
|
131
|
+
dimmed?: boolean
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The size index that the sheet should start to dim the background.
|
|
135
|
+
* This is ignored if `dimmed` is set to `false`.
|
|
136
|
+
*
|
|
137
|
+
* @default 0
|
|
138
|
+
*/
|
|
139
|
+
dimmedIndex?: number
|
|
140
|
+
|
|
123
141
|
/**
|
|
124
142
|
* Prevents interactive dismissal of the Sheet.
|
|
125
143
|
*
|