@lodev09/react-native-true-sheet 0.12.1 → 0.12.3

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.
@@ -103,13 +103,6 @@ class TrueSheetView(context: Context) :
103
103
  eventDispatcher?.dispatchEvent(DismissEvent(surfaceId, id))
104
104
  }
105
105
 
106
- // Configure when showing and size changed
107
- setOnSizeChangeListener(object : RootSheetView.OnSizeChangeListener {
108
- override fun onSizeChange(width: Int, height: Int) {
109
- maxScreenHeight = height
110
- }
111
- })
112
-
113
106
  // Configure sheet behavior events
114
107
  behavior.addBottomSheetCallback(
115
108
  object : BottomSheetBehavior.BottomSheetCallback() {
@@ -179,13 +172,13 @@ class TrueSheetView(context: Context) :
179
172
  // Initialize content
180
173
  UiThreadUtil.runOnUiThread {
181
174
  // 1st child is the content view
182
- val contentView = it.getChildAt(0) as ViewGroup
183
- setContentHeight(contentView.height)
175
+ val contentView = it.getChildAt(0) as ViewGroup?
176
+ setContentHeight(contentView?.height ?: 0)
184
177
 
185
178
  // 2nd child is the footer view
186
- val footerView = it.getChildAt(1) as ViewGroup
179
+ val footerView = it.getChildAt(1) as ViewGroup?
187
180
  sheetDialog.footerView = footerView
188
- setFooterHeight(footerView.height)
181
+ setFooterHeight(footerView?.height ?: 0)
189
182
 
190
183
  if (initialIndex >= 0) {
191
184
  currentSizeIndex = initialIndex
@@ -45,6 +45,11 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
45
45
 
46
46
  private var rctScrollView: RCTScrollView?
47
47
 
48
+ private var uiManager: RCTUIManager? {
49
+ guard let uiManager = bridge?.uiManager else { return nil }
50
+ return uiManager
51
+ }
52
+
48
53
  // MARK: - Setup
49
54
 
50
55
  init(with bridge: RCTBridge) {
@@ -143,7 +148,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
143
148
  guard let containerView else { return }
144
149
 
145
150
  let size = CGSize(width: width, height: containerView.bounds.height)
146
- bridge?.uiManager.setSize(size, for: containerView)
151
+ uiManager?.setSize(size, for: containerView)
147
152
  }
148
153
 
149
154
  func viewControllerWillAppear() {
@@ -297,7 +302,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
297
302
 
298
303
  @objc
299
304
  func setScrollableHandle(_ tag: NSNumber?) {
300
- let view = bridge?.uiManager.view(forReactTag: tag) as? RCTScrollView
305
+ let view = uiManager?.view(forReactTag: tag) as? RCTScrollView
301
306
  rctScrollView = view
302
307
  }
303
308
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodev09/react-native-true-sheet",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
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",