@lodev09/react-native-true-sheet 0.2.1 → 0.3.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 +2 -5
- package/android/build.gradle +1 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPackage.kt +2 -7
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +233 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +42 -10
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewModule.kt +63 -0
- package/android/src/main/java/com/lodev09/truesheet/core/Events.kt +43 -0
- package/android/src/main/java/com/lodev09/truesheet/core/RootViewGroup.kt +136 -0
- package/android/src/main/java/com/lodev09/truesheet/core/SheetBehavior.kt +198 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/maxSize.kt +49 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/toDIP.kt +5 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/withPromise.kt +13 -0
- package/ios/Extensions/UIViewController+detentForSize.swift +22 -13
- package/ios/TrueSheetView.swift +3 -3
- package/ios/TrueSheetViewManager.m +1 -1
- package/lib/commonjs/TrueSheet.js +12 -5
- package/lib/commonjs/TrueSheet.js.map +1 -1
- package/lib/commonjs/TrueSheetModule.js +3 -1
- package/lib/commonjs/TrueSheetModule.js.map +1 -1
- package/lib/module/TrueSheet.js +12 -5
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheetModule.js +3 -1
- package/lib/module/TrueSheetModule.js.map +1 -1
- package/lib/typescript/src/TrueSheet.d.ts +1 -1
- package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheetModule.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +4 -3
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/TrueSheet.tsx +21 -10
- package/src/TrueSheetModule.ts +3 -2
- package/src/types.ts +4 -3
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
package com.lodev09.truesheet.core
|
|
2
|
+
|
|
3
|
+
import android.graphics.Point
|
|
4
|
+
import android.view.MotionEvent
|
|
5
|
+
import android.view.ViewGroup
|
|
6
|
+
import android.widget.ScrollView
|
|
7
|
+
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
8
|
+
import com.facebook.react.uimanager.PixelUtil
|
|
9
|
+
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
|
10
|
+
import com.lodev09.truesheet.utils.toDIP
|
|
11
|
+
|
|
12
|
+
data class SizeInfo(val index: Int, val value: Float)
|
|
13
|
+
|
|
14
|
+
class SheetBehavior<T : ViewGroup> : BottomSheetBehavior<T>() {
|
|
15
|
+
var maxSize: Point = Point()
|
|
16
|
+
|
|
17
|
+
var contentView: ViewGroup? = null
|
|
18
|
+
var footerView: ViewGroup? = null
|
|
19
|
+
|
|
20
|
+
override fun onInterceptTouchEvent(parent: CoordinatorLayout, child: T, event: MotionEvent): Boolean {
|
|
21
|
+
contentView?.let {
|
|
22
|
+
val isDownEvent = (event.actionMasked == MotionEvent.ACTION_DOWN)
|
|
23
|
+
val expanded = state == STATE_EXPANDED
|
|
24
|
+
|
|
25
|
+
if (isDownEvent && expanded) {
|
|
26
|
+
for (i in 0 until it.childCount) {
|
|
27
|
+
val contentChild = it.getChildAt(i)
|
|
28
|
+
val scrolled = (contentChild is ScrollView && contentChild.scrollY > 0)
|
|
29
|
+
|
|
30
|
+
if (!scrolled) continue
|
|
31
|
+
if (isInsideSheet(contentChild as ScrollView, event)) {
|
|
32
|
+
return false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return super.onInterceptTouchEvent(parent, child, event)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private fun isInsideSheet(scrollView: ScrollView, event: MotionEvent): Boolean {
|
|
42
|
+
val x = event.x
|
|
43
|
+
val y = event.y
|
|
44
|
+
|
|
45
|
+
val position = IntArray(2)
|
|
46
|
+
scrollView.getLocationOnScreen(position)
|
|
47
|
+
|
|
48
|
+
val nestedX = position[0]
|
|
49
|
+
val nestedY = position[1]
|
|
50
|
+
|
|
51
|
+
val boundRight = nestedX + scrollView.width
|
|
52
|
+
val boundBottom = nestedY + scrollView.height
|
|
53
|
+
|
|
54
|
+
return (x > nestedX && x < boundRight && y > nestedY && y < boundBottom) ||
|
|
55
|
+
event.action == MotionEvent.ACTION_CANCEL
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private fun getSizeHeight(size: Any, contentHeight: Int): Int {
|
|
59
|
+
val maxHeight = maxSize.y
|
|
60
|
+
|
|
61
|
+
val height =
|
|
62
|
+
when (size) {
|
|
63
|
+
is Double -> PixelUtil.toPixelFromDIP(size).toInt()
|
|
64
|
+
|
|
65
|
+
is Int -> PixelUtil.toPixelFromDIP(size.toDouble()).toInt()
|
|
66
|
+
|
|
67
|
+
is String -> {
|
|
68
|
+
return when (size) {
|
|
69
|
+
"auto" -> contentHeight
|
|
70
|
+
|
|
71
|
+
"large" -> maxHeight
|
|
72
|
+
|
|
73
|
+
"medium" -> (maxHeight * 0.50).toInt()
|
|
74
|
+
|
|
75
|
+
"small" -> (maxHeight * 0.25).toInt()
|
|
76
|
+
|
|
77
|
+
else -> {
|
|
78
|
+
if (size.endsWith('%')) {
|
|
79
|
+
val percent = size.trim('%').toDoubleOrNull()
|
|
80
|
+
return if (percent == null) {
|
|
81
|
+
0
|
|
82
|
+
} else {
|
|
83
|
+
((percent / 100) * maxHeight).toInt()
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
val fixedHeight = size.toDoubleOrNull()
|
|
87
|
+
return if (fixedHeight == null) {
|
|
88
|
+
0
|
|
89
|
+
} else {
|
|
90
|
+
PixelUtil.toPixelFromDIP(fixedHeight).toInt()
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
else -> (maxHeight * 0.5).toInt()
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return minOf(height, maxHeight)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
fun configure(sizes: Array<Any>) {
|
|
104
|
+
var contentHeight = 0
|
|
105
|
+
|
|
106
|
+
contentView?.let { contentHeight = it.height }
|
|
107
|
+
footerView?.let { contentHeight += it.height }
|
|
108
|
+
|
|
109
|
+
// Configure sheet sizes
|
|
110
|
+
apply {
|
|
111
|
+
isFitToContents = true
|
|
112
|
+
isHideable = true
|
|
113
|
+
skipCollapsed = false
|
|
114
|
+
|
|
115
|
+
when (sizes.size) {
|
|
116
|
+
1 -> {
|
|
117
|
+
maxHeight = getSizeHeight(sizes[0], contentHeight)
|
|
118
|
+
skipCollapsed = true
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
2 -> {
|
|
122
|
+
peekHeight = getSizeHeight(sizes[0], contentHeight)
|
|
123
|
+
maxHeight = getSizeHeight(sizes[1], contentHeight)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
3 -> {
|
|
127
|
+
// Enables half expanded
|
|
128
|
+
isFitToContents = false
|
|
129
|
+
|
|
130
|
+
peekHeight = getSizeHeight(sizes[0], contentHeight)
|
|
131
|
+
halfExpandedRatio = getSizeHeight(sizes[1], contentHeight).toFloat() / maxSize.y.toFloat()
|
|
132
|
+
maxHeight = getSizeHeight(sizes[2], contentHeight)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
fun getSizeInfoForState(sizeCount: Int, state: Int): SizeInfo? =
|
|
139
|
+
when (sizeCount) {
|
|
140
|
+
1 -> {
|
|
141
|
+
when (state) {
|
|
142
|
+
STATE_EXPANDED -> SizeInfo(0, PixelUtil.toDIPFromPixel(maxHeight.toFloat()))
|
|
143
|
+
else -> null
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
2 -> {
|
|
148
|
+
when (state) {
|
|
149
|
+
STATE_COLLAPSED -> SizeInfo(0, toDIP(peekHeight))
|
|
150
|
+
STATE_EXPANDED -> SizeInfo(1, toDIP(maxHeight))
|
|
151
|
+
else -> null
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
3 -> {
|
|
156
|
+
when (state) {
|
|
157
|
+
STATE_COLLAPSED -> SizeInfo(0, toDIP(peekHeight))
|
|
158
|
+
|
|
159
|
+
STATE_HALF_EXPANDED -> {
|
|
160
|
+
val height = halfExpandedRatio * maxSize.y
|
|
161
|
+
SizeInfo(1, toDIP(height.toInt()))
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
STATE_EXPANDED -> SizeInfo(2, toDIP(maxHeight))
|
|
165
|
+
|
|
166
|
+
else -> null
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
else -> null
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
fun setStateForSizeIndex(sizeCount: Int, index: Int) {
|
|
174
|
+
state =
|
|
175
|
+
when (sizeCount) {
|
|
176
|
+
1 -> STATE_EXPANDED
|
|
177
|
+
|
|
178
|
+
2 -> {
|
|
179
|
+
when (index) {
|
|
180
|
+
0 -> STATE_COLLAPSED
|
|
181
|
+
1 -> STATE_EXPANDED
|
|
182
|
+
else -> STATE_HIDDEN
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
3 -> {
|
|
187
|
+
when (index) {
|
|
188
|
+
0 -> STATE_COLLAPSED
|
|
189
|
+
1 -> STATE_HALF_EXPANDED
|
|
190
|
+
2 -> STATE_EXPANDED
|
|
191
|
+
else -> STATE_HIDDEN
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
else -> STATE_HIDDEN
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
package com.lodev09.truesheet.utils
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.graphics.Point
|
|
6
|
+
import android.view.WindowManager
|
|
7
|
+
import com.facebook.infer.annotation.Assertions
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* To get the size of the screen, we use information from the WindowManager and default Display.
|
|
11
|
+
* We don't use DisplayMetricsHolder, or Display#getSize() because they return values that include
|
|
12
|
+
* the status bar. We only want the values of what will actually be shown on screen. We use
|
|
13
|
+
* Display#getSize() to determine if the screen is in portrait or landscape. We don't use
|
|
14
|
+
* getRotation because the 'natural' rotation will be portrait on phones and landscape on tablets.
|
|
15
|
+
* This should only be called on the native modules/shadow nodes thread.
|
|
16
|
+
*/
|
|
17
|
+
@SuppressLint("DiscouragedApi", "InternalInsetResource")
|
|
18
|
+
fun maxSize(context: Context): Point {
|
|
19
|
+
val minPoint = Point()
|
|
20
|
+
val maxPoint = Point()
|
|
21
|
+
val sizePoint = Point()
|
|
22
|
+
|
|
23
|
+
val wm = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
|
|
24
|
+
val display = Assertions.assertNotNull(wm).defaultDisplay
|
|
25
|
+
// getCurrentSizeRange will return the min and max width and height that the window can be
|
|
26
|
+
display.getCurrentSizeRange(minPoint, maxPoint)
|
|
27
|
+
// getSize will return the dimensions of the screen in its current orientation
|
|
28
|
+
display.getSize(sizePoint)
|
|
29
|
+
val attrs = intArrayOf(android.R.attr.windowFullscreen)
|
|
30
|
+
val theme = context.theme
|
|
31
|
+
val ta = theme.obtainStyledAttributes(attrs)
|
|
32
|
+
val windowFullscreen = ta.getBoolean(0, false)
|
|
33
|
+
|
|
34
|
+
// We need to add the status bar height to the height if we have a fullscreen window,
|
|
35
|
+
// because Display.getCurrentSizeRange doesn't include it.
|
|
36
|
+
val resources = context.resources
|
|
37
|
+
val statusBarId = resources.getIdentifier("status_bar_height", "dimen", "android")
|
|
38
|
+
var statusBarHeight = 0
|
|
39
|
+
if (windowFullscreen && statusBarId > 0) {
|
|
40
|
+
statusBarHeight = resources.getDimension(statusBarId).toInt()
|
|
41
|
+
}
|
|
42
|
+
return if (sizePoint.x < sizePoint.y) {
|
|
43
|
+
// If we are vertical the width value comes from min width and height comes from max height
|
|
44
|
+
Point(minPoint.x, maxPoint.y + statusBarHeight)
|
|
45
|
+
} else {
|
|
46
|
+
// If we are horizontal the width value comes from max width and height comes from min height
|
|
47
|
+
Point(maxPoint.x, minPoint.y + statusBarHeight)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
package com.lodev09.truesheet.utils
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Promise
|
|
4
|
+
|
|
5
|
+
inline fun withPromise(promise: Promise, closure: () -> Any?) {
|
|
6
|
+
try {
|
|
7
|
+
val result = closure()
|
|
8
|
+
promise.resolve(result)
|
|
9
|
+
} catch (e: Throwable) {
|
|
10
|
+
e.printStackTrace()
|
|
11
|
+
promise.reject("Error", e.message, e.cause)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -62,6 +62,10 @@ extension UIViewController {
|
|
|
62
62
|
resolution(id, value)
|
|
63
63
|
return value
|
|
64
64
|
}
|
|
65
|
+
} else {
|
|
66
|
+
return detentFor(identifier: .medium) { value in
|
|
67
|
+
resolution(id, value)
|
|
68
|
+
}
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
|
|
@@ -79,30 +83,35 @@ extension UIViewController {
|
|
|
79
83
|
return detentFor(identifier: .large) { value in
|
|
80
84
|
resolution(UISheetPresentationController.Detent.Identifier.large.rawValue, value)
|
|
81
85
|
}
|
|
82
|
-
case "auto":
|
|
83
|
-
if #available(iOS 16.0, *), let height {
|
|
84
|
-
return .custom(identifier: identifier(from: id)) { context in
|
|
85
|
-
let value = min(height, context.maximumDetentValue)
|
|
86
|
-
resolution(id, value)
|
|
87
|
-
return value
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
86
|
default:
|
|
91
87
|
if #available(iOS 16.0, *) {
|
|
92
|
-
|
|
93
|
-
stringSize.removeAll(where: { $0 == "%" })
|
|
94
|
-
let floatSize = CGFloat((stringSize as NSString).floatValue)
|
|
95
|
-
if floatSize > 0.0 {
|
|
88
|
+
if stringSize == "auto" {
|
|
96
89
|
return .custom(identifier: identifier(from: id)) { context in
|
|
97
|
-
let value = min(
|
|
90
|
+
let value = min(height ?? context.maximumDetentValue / 2, context.maximumDetentValue)
|
|
98
91
|
resolution(id, value)
|
|
99
92
|
return value
|
|
100
93
|
}
|
|
94
|
+
} else {
|
|
95
|
+
// Percent
|
|
96
|
+
stringSize.removeAll(where: { $0 == "%" })
|
|
97
|
+
let floatSize = CGFloat((stringSize as NSString).floatValue)
|
|
98
|
+
if floatSize > 0.0 {
|
|
99
|
+
return .custom(identifier: identifier(from: id)) { context in
|
|
100
|
+
let value = min((floatSize / 100) * context.maximumDetentValue, context.maximumDetentValue)
|
|
101
|
+
resolution(id, value)
|
|
102
|
+
return value
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
return detentFor(identifier: .medium) { value in
|
|
108
|
+
resolution(id, value)
|
|
101
109
|
}
|
|
102
110
|
}
|
|
103
111
|
}
|
|
104
112
|
}
|
|
105
113
|
|
|
114
|
+
resolution(id, 0)
|
|
106
115
|
return .medium()
|
|
107
116
|
}
|
|
108
117
|
|
package/ios/TrueSheetView.swift
CHANGED
|
@@ -152,7 +152,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
152
152
|
|
|
153
153
|
@objc
|
|
154
154
|
func setSizes(_ sizes: [Any]) {
|
|
155
|
-
self.sizes = sizes
|
|
155
|
+
self.sizes = Array(sizes.prefix(3))
|
|
156
156
|
configureSheetIfPresented()
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -178,7 +178,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
178
178
|
func dismiss(promise: Promise) {
|
|
179
179
|
if isPresented {
|
|
180
180
|
viewController.dismiss(animated: true) {
|
|
181
|
-
promise.resolve(
|
|
181
|
+
promise.resolve(nil)
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -241,7 +241,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
|
|
|
241
241
|
self.isPresented = true
|
|
242
242
|
self.onPresent?(nil)
|
|
243
243
|
|
|
244
|
-
promise.resolve(
|
|
244
|
+
promise.resolve(nil)
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
}
|
|
@@ -37,7 +37,7 @@ class TrueSheet extends _react.PureComponent {
|
|
|
37
37
|
}
|
|
38
38
|
return nodeHandle;
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
updateState() {
|
|
41
41
|
const scrollableHandle = this.props.scrollRef?.current ? (0, _reactNative.findNodeHandle)(this.props.scrollRef.current) : null;
|
|
42
42
|
this.setState({
|
|
43
43
|
scrollableHandle
|
|
@@ -53,10 +53,13 @@ class TrueSheet extends _react.PureComponent {
|
|
|
53
53
|
this.props.onDismiss?.();
|
|
54
54
|
}
|
|
55
55
|
componentDidMount() {
|
|
56
|
-
this.
|
|
56
|
+
if (this.props.sizes && this.props.sizes.length > 3) {
|
|
57
|
+
console.warn('TrueSheet only supports a maximum of 3 sizes; collapsed, half-expanded and expanded. Check your `sizes` prop.');
|
|
58
|
+
}
|
|
59
|
+
this.updateState();
|
|
57
60
|
}
|
|
58
61
|
componentDidUpdate() {
|
|
59
|
-
this.
|
|
62
|
+
this.updateState();
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
/**
|
|
@@ -84,17 +87,21 @@ class TrueSheet extends _react.PureComponent {
|
|
|
84
87
|
onDismiss: this.onDismiss,
|
|
85
88
|
onSizeChange: this.onSizeChange
|
|
86
89
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
90
|
+
collapsable: false,
|
|
87
91
|
style: {
|
|
88
92
|
backgroundColor: this.props.backgroundColor ?? 'white'
|
|
89
93
|
}
|
|
90
94
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
95
|
+
collapsable: false,
|
|
91
96
|
style: this.props.style
|
|
92
|
-
}, this.props.children), /*#__PURE__*/_react.default.createElement(_reactNative.View,
|
|
97
|
+
}, this.props.children), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
98
|
+
collapsable: false
|
|
99
|
+
}, !!FooterComponent && /*#__PURE__*/_react.default.createElement(FooterComponent, null))));
|
|
93
100
|
}
|
|
94
101
|
}
|
|
95
102
|
exports.TrueSheet = TrueSheet;
|
|
96
103
|
const $nativeSheet = {
|
|
97
104
|
position: 'absolute',
|
|
98
|
-
zIndex: -
|
|
105
|
+
zIndex: -9999
|
|
99
106
|
};
|
|
100
107
|
//# sourceMappingURL=TrueSheet.js.map
|
|
@@ -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","LINKING_ERROR","Platform","select","ios","ComponentName","TrueSheetNativeView","requireNativeComponent","Error","TrueSheet","PureComponent","displayName","constructor","props","ref","createRef","onDismiss","bind","onPresent","onSizeChange","state","scrollableHandle","handle","nodeHandle","findNodeHandle","current","
|
|
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","LINKING_ERROR","Platform","select","ios","ComponentName","TrueSheetNativeView","requireNativeComponent","Error","TrueSheet","PureComponent","displayName","constructor","props","ref","createRef","onDismiss","bind","onPresent","onSizeChange","state","scrollableHandle","handle","nodeHandle","findNodeHandle","current","updateState","scrollRef","setState","event","nativeEvent","componentDidMount","sizes","length","console","warn","componentDidUpdate","present","index","TrueSheetModule","dismiss","render","FooterComponent","createElement","style","$nativeSheet","View","collapsable","backgroundColor","children","exports","position","zIndex"],"sourceRoot":"../../src","sources":["TrueSheet.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAYA,IAAAE,gBAAA,GAAAF,OAAA;AAAmD,SAAAG,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,SAAAL,wBAAAK,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,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,C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IAElD,oBACEnE,MAAA,CAAAW,OAAA,CAAAyD,aAAA,CAACrC,mBAAmB;MAClBQ,GAAG,EAAE,IAAI,CAACA,GAAI;MACd8B,KAAK,EAAEC,YAAa;MACpBxB,gBAAgB,EAAE,IAAI,CAACD,KAAK,CAACC,gBAAiB;MAC9CW,KAAK,EAAE,IAAI,CAACnB,KAAK,CAACmB,KAAK,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAE;MAC/Cd,SAAS,EAAE,IAAI,CAACA,SAAU;MAC1BF,SAAS,EAAE,IAAI,CAACA,SAAU;MAC1BG,YAAY,EAAE,IAAI,CAACA;IAAa,gBAEhC5C,MAAA,CAAAW,OAAA,CAAAyD,aAAA,CAACjE,YAAA,CAAAoE,IAAI;MACHC,WAAW,EAAE,KAAM;MACnBH,KAAK,EAAE;QAAEI,eAAe,EAAE,IAAI,CAACnC,KAAK,CAACmC,eAAe,IAAI;MAAQ;IAAE,gBAElEzE,MAAA,CAAAW,OAAA,CAAAyD,aAAA,CAACjE,YAAA,CAAAoE,IAAI;MAACC,WAAW,EAAE,KAAM;MAACH,KAAK,EAAE,IAAI,CAAC/B,KAAK,CAAC+B;IAAM,GAC/C,IAAI,CAAC/B,KAAK,CAACoC,QACR,CAAC,eACP1E,MAAA,CAAAW,OAAA,CAAAyD,aAAA,CAACjE,YAAA,CAAAoE,IAAI;MAACC,WAAW,EAAE;IAAM,GAAE,CAAC,CAACL,eAAe,iBAAInE,MAAA,CAAAW,OAAA,CAAAyD,aAAA,CAACD,eAAe,MAAE,CAAQ,CACtE,CACa,CAAC;EAE1B;AACF;AAACQ,OAAA,CAAAzC,SAAA,GAAAA,SAAA;AAED,MAAMoC,YAAuB,GAAG;EAC9BM,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]}
|
|
@@ -9,7 +9,9 @@ const LINKING_ERROR = `The package '@lodev09/react-native-true-sheet' doesn't se
|
|
|
9
9
|
ios: "- You have run 'pod install'\n",
|
|
10
10
|
default: ''
|
|
11
11
|
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
// NativeModules automatically resolves 'TrueSheetView' to 'TrueSheetViewModule'
|
|
14
|
+
const TrueSheetModule = exports.TrueSheetModule = _reactNative.NativeModules.TrueSheetView ? _reactNative.NativeModules.TrueSheetView : new Proxy({}, {
|
|
13
15
|
get() {
|
|
14
16
|
throw new Error(LINKING_ERROR);
|
|
15
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","TrueSheetModule","exports","NativeModules","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","TrueSheetModule","exports","NativeModules","TrueSheetView","Proxy","get","Error"],"sourceRoot":"../../src","sources":["TrueSheetModule.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GAChB,2FAA0F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACO,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAGE,0BAAa,CAACC,aAAa,GACtDD,0BAAa,CAACC,aAAa,GAC3B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACX,aAAa,CAAC;EAChC;AACF,CACF,CAAC","ignoreList":[]}
|
package/lib/module/TrueSheet.js
CHANGED
|
@@ -29,7 +29,7 @@ export class TrueSheet extends PureComponent {
|
|
|
29
29
|
}
|
|
30
30
|
return nodeHandle;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
updateState() {
|
|
33
33
|
const scrollableHandle = this.props.scrollRef?.current ? findNodeHandle(this.props.scrollRef.current) : null;
|
|
34
34
|
this.setState({
|
|
35
35
|
scrollableHandle
|
|
@@ -45,10 +45,13 @@ export class TrueSheet extends PureComponent {
|
|
|
45
45
|
this.props.onDismiss?.();
|
|
46
46
|
}
|
|
47
47
|
componentDidMount() {
|
|
48
|
-
this.
|
|
48
|
+
if (this.props.sizes && this.props.sizes.length > 3) {
|
|
49
|
+
console.warn('TrueSheet only supports a maximum of 3 sizes; collapsed, half-expanded and expanded. Check your `sizes` prop.');
|
|
50
|
+
}
|
|
51
|
+
this.updateState();
|
|
49
52
|
}
|
|
50
53
|
componentDidUpdate() {
|
|
51
|
-
this.
|
|
54
|
+
this.updateState();
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
/**
|
|
@@ -76,16 +79,20 @@ export class TrueSheet extends PureComponent {
|
|
|
76
79
|
onDismiss: this.onDismiss,
|
|
77
80
|
onSizeChange: this.onSizeChange
|
|
78
81
|
}, /*#__PURE__*/React.createElement(View, {
|
|
82
|
+
collapsable: false,
|
|
79
83
|
style: {
|
|
80
84
|
backgroundColor: this.props.backgroundColor ?? 'white'
|
|
81
85
|
}
|
|
82
86
|
}, /*#__PURE__*/React.createElement(View, {
|
|
87
|
+
collapsable: false,
|
|
83
88
|
style: this.props.style
|
|
84
|
-
}, this.props.children), /*#__PURE__*/React.createElement(View,
|
|
89
|
+
}, this.props.children), /*#__PURE__*/React.createElement(View, {
|
|
90
|
+
collapsable: false
|
|
91
|
+
}, !!FooterComponent && /*#__PURE__*/React.createElement(FooterComponent, null))));
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
94
|
const $nativeSheet = {
|
|
88
95
|
position: 'absolute',
|
|
89
|
-
zIndex: -
|
|
96
|
+
zIndex: -9999
|
|
90
97
|
};
|
|
91
98
|
//# sourceMappingURL=TrueSheet.js.map
|
|
@@ -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","
|
|
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","FooterComponent","createElement","style","$nativeSheet","collapsable","backgroundColor","children","position","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,QAKC,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;AAYrC,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;EAC3Ee,WAAW,GAAG,WAAW;EAIzBC,WAAWA,CAACC,KAAqB,EAAE;IACjC,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,GAAG,gBAAGjB,SAAS,CAAY,CAAC;IAEjC,IAAI,CAACkB,SAAS,GAAG,IAAI,CAACA,SAAS,CAACC,IAAI,CAAC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eAAe,iBAAI5C,KAAA,CAAA6C,aAAA,CAACD,eAAe,MAAE,CAAQ,CACtE,CACa,CAAC;EAE1B;AACF;AAEA,MAAMG,YAAuB,GAAG;EAC9BI,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]}
|
|
@@ -3,7 +3,9 @@ const LINKING_ERROR = `The package '@lodev09/react-native-true-sheet' doesn't se
|
|
|
3
3
|
ios: "- You have run 'pod install'\n",
|
|
4
4
|
default: ''
|
|
5
5
|
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
// NativeModules automatically resolves 'TrueSheetView' to 'TrueSheetViewModule'
|
|
8
|
+
export const TrueSheetModule = NativeModules.TrueSheetView ? NativeModules.TrueSheetView : new Proxy({}, {
|
|
7
9
|
get() {
|
|
8
10
|
throw new Error(LINKING_ERROR);
|
|
9
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","TrueSheetModule","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","TrueSheetModule","TrueSheetView","Proxy","get","Error"],"sourceRoot":"../../src","sources":["TrueSheetModule.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GAChB,2FAA0F,GAC3FD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,OAAO,MAAMC,eAAe,GAAGN,aAAa,CAACO,aAAa,GACtDP,aAAa,CAACO,aAAa,GAC3B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -8,7 +8,7 @@ export declare class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetSt
|
|
|
8
8
|
private readonly ref;
|
|
9
9
|
constructor(props: TrueSheetProps);
|
|
10
10
|
private get handle();
|
|
11
|
-
private
|
|
11
|
+
private updateState;
|
|
12
12
|
private onSizeChange;
|
|
13
13
|
private onPresent;
|
|
14
14
|
private onDismiss;
|
|
@@ -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;AAYlG,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAA;AA6B9D,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,
|
|
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;AAYlG,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAA;AA6B9D,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;IAItC;;OAEG;IACU,OAAO;IAIpB,MAAM,IAAI,SAAS;CAyBpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrueSheetModule.d.ts","sourceRoot":"","sources":["../../../src/TrueSheetModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TrueSheetModule.d.ts","sourceRoot":"","sources":["../../../src/TrueSheetModule.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,eAAe,KASvB,CAAA"}
|
|
@@ -57,16 +57,17 @@ export interface TrueSheetProps extends ViewProps {
|
|
|
57
57
|
*/
|
|
58
58
|
backgroundColor?: ColorValue;
|
|
59
59
|
/**
|
|
60
|
-
* The main scrollable ref that Sheet should handle.
|
|
60
|
+
* The main scrollable ref that Sheet should handle on IOS.
|
|
61
|
+
* @platform ios
|
|
61
62
|
*/
|
|
62
63
|
scrollRef?: RefObject<Component<unknown>>;
|
|
63
64
|
/**
|
|
64
65
|
* The sizes you want the Sheet to support.
|
|
65
|
-
*
|
|
66
|
+
* Maximum of 3 sizes only; collapsed, half-expanded, expanded.
|
|
66
67
|
*
|
|
67
68
|
* Example:
|
|
68
69
|
* ```ts
|
|
69
|
-
* size={['auto',
|
|
70
|
+
* size={['auto', '60%', 'large']}
|
|
70
71
|
* ```
|
|
71
72
|
*
|
|
72
73
|
* @default ['medium', 'large']
|
|
@@ -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,OAAO,KA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;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IAExC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IAEtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;CAChD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lodev09/react-native-true-sheet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "The true native bottom sheet. 💩",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typecheck": "tsc --noEmit",
|
|
32
32
|
"lint": "eslint --fix \"**/*.{js,ts,tsx}\"",
|
|
33
33
|
"format": "prettier --write \"**/*.{js,ts,tsx}\"",
|
|
34
|
-
"tidy": "yarn typecheck && yarn lint && yarn format && scripts/swiftlint.sh && scripts/
|
|
34
|
+
"tidy": "yarn typecheck && yarn lint && yarn format && scripts/swiftlint.sh && scripts/ktlint.sh",
|
|
35
35
|
"clean": "del-cli android/build lib && yarn workspace true-sheet-example clean",
|
|
36
36
|
"prepare": "bob build",
|
|
37
37
|
"release": "release-it"
|
|
@@ -127,6 +127,9 @@
|
|
|
127
127
|
},
|
|
128
128
|
"eslintConfig": {
|
|
129
129
|
"root": true,
|
|
130
|
+
"ignorePatterns": [
|
|
131
|
+
"lib"
|
|
132
|
+
],
|
|
130
133
|
"extends": [
|
|
131
134
|
"plugin:@typescript-eslint/recommended",
|
|
132
135
|
"eslint:recommended",
|