react-native-sheet2 1.1.21 → 1.1.22
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/ios/SheetViewManager.swift +20 -8
- package/package.json +1 -1
|
@@ -30,11 +30,13 @@ class ModalHostShadowView: RCTShadowView {
|
|
|
30
30
|
super.layoutSubviews(with: layoutContext)
|
|
31
31
|
let tag = self.reactTag.intValue
|
|
32
32
|
var size = reactSubviews()[0].contentFrame.size
|
|
33
|
-
let view = ModalHostShadowView.attachedViews[tag]
|
|
34
|
-
let maxheight = view?.sheetMaxHeightSize?.doubleValue ?? .infinity
|
|
35
|
-
let minHeight = view?.sheetMinHeightSize?.doubleValue ?? .zero
|
|
36
33
|
|
|
37
34
|
DispatchQueue.main.async {
|
|
35
|
+
let view = ModalHostShadowView.attachedViews[tag]
|
|
36
|
+
let maxWidth = view?.sheetWidth ?? .infinity
|
|
37
|
+
let maxheight = view?.sheetMaxHeightSize?.doubleValue ?? .infinity
|
|
38
|
+
let minHeight = view?.sheetMinHeightSize?.doubleValue ?? .zero
|
|
39
|
+
|
|
38
40
|
if size.height > maxheight {
|
|
39
41
|
debugPrint("😀 constraint \(tag) \(size) \(maxheight)")
|
|
40
42
|
size.height = maxheight
|
|
@@ -45,9 +47,14 @@ class ModalHostShadowView: RCTShadowView {
|
|
|
45
47
|
size.height = minHeight
|
|
46
48
|
view!.notifyForBoundsChange(newBounds: size)
|
|
47
49
|
}
|
|
50
|
+
if size.width > maxWidth {
|
|
51
|
+
debugPrint("😀 constraint \(tag) \(size) \(maxWidth)")
|
|
52
|
+
size.width = maxWidth
|
|
53
|
+
view!.notifyForBoundsChange(newBounds: size)
|
|
54
|
+
}
|
|
48
55
|
view?._modalViewController?.setSizes([.fixed(size.height)])
|
|
56
|
+
debugPrint("😀 layout(with \(tag) \(size) \(maxheight)")
|
|
49
57
|
}
|
|
50
|
-
debugPrint("😀 layout(with \(tag) \(size) \(maxheight)")
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
60
|
|
|
@@ -154,7 +161,7 @@ class HostFittedSheet: UIView {
|
|
|
154
161
|
debugPrint("", increasedHeight)
|
|
155
162
|
}
|
|
156
163
|
|
|
157
|
-
|
|
164
|
+
var sheetMaxWidthSize: NSNumber?
|
|
158
165
|
private var dismissable = true
|
|
159
166
|
var sheetMaxHeightSize: NSNumber?
|
|
160
167
|
var sheetMinHeightSize: NSNumber?
|
|
@@ -174,7 +181,7 @@ class HostFittedSheet: UIView {
|
|
|
174
181
|
}
|
|
175
182
|
}
|
|
176
183
|
|
|
177
|
-
|
|
184
|
+
var sheetWidth: CGFloat {
|
|
178
185
|
return CGFloat(sheetMaxWidthSize?.floatValue ?? Float(UIScreen.main.bounds.width))
|
|
179
186
|
}
|
|
180
187
|
|
|
@@ -239,17 +246,22 @@ class HostFittedSheet: UIView {
|
|
|
239
246
|
size = .init(width: self.sheetWidth, height: CGFloat(self._sheetSize!.floatValue))
|
|
240
247
|
debugPrint("😀 else", size)
|
|
241
248
|
}
|
|
249
|
+
var shouldUpdate = false
|
|
242
250
|
if size.width > self.sheetWidth {
|
|
243
251
|
size.width = self.sheetWidth
|
|
252
|
+
shouldUpdate = true
|
|
244
253
|
}
|
|
245
254
|
// if maxSize is present notify react native view
|
|
246
255
|
if self.sheetMaxHeightSize != nil && size.height > self.sheetMaxHeightSize!.doubleValue {
|
|
247
256
|
size.height = self.sheetMaxHeightSize!.doubleValue
|
|
248
|
-
|
|
257
|
+
shouldUpdate = true
|
|
249
258
|
}
|
|
250
259
|
// if maxSize is present notify react native view
|
|
251
260
|
if self.sheetMinHeightSize != nil && size.height < self.sheetMinHeightSize!.doubleValue {
|
|
252
261
|
size.height = self.sheetMinHeightSize!.doubleValue
|
|
262
|
+
shouldUpdate = true
|
|
263
|
+
}
|
|
264
|
+
if shouldUpdate {
|
|
253
265
|
self.notifyForBoundsChange(newBounds: size)
|
|
254
266
|
}
|
|
255
267
|
self._modalViewController = SheetViewController(
|
|
@@ -344,7 +356,7 @@ class HostFittedSheet: UIView {
|
|
|
344
356
|
extension UIView {
|
|
345
357
|
func find(_ nId: String, deepIndex: Int) -> UIView? {
|
|
346
358
|
if deepIndex >= 10 { return nil }
|
|
347
|
-
if self.nativeID
|
|
359
|
+
if self.nativeID?.contains(nId) == true || self.accessibilityIdentifier?.contains(nId) == true {
|
|
348
360
|
return self
|
|
349
361
|
}
|
|
350
362
|
|