@lodev09/react-native-true-sheet 0.3.0 → 0.4.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.
@@ -19,7 +19,7 @@ import com.lodev09.truesheet.core.PresentEvent
19
19
  import com.lodev09.truesheet.core.RootViewGroup
20
20
  import com.lodev09.truesheet.core.SheetBehavior
21
21
  import com.lodev09.truesheet.core.SizeChangeEvent
22
- import com.lodev09.truesheet.utils.maxSize
22
+ import com.lodev09.truesheet.core.Utils
23
23
 
24
24
  class TrueSheetView(context: Context) :
25
25
  ViewGroup(context),
@@ -63,7 +63,9 @@ class TrueSheetView(context: Context) :
63
63
 
64
64
  // Configure Sheet events
65
65
  sheetBehavior.apply {
66
- maxSize = maxSize(context)
66
+
67
+ // Set our default max height
68
+ maxSheetSize = Utils.maxSize(context)
67
69
 
68
70
  addBottomSheetCallback(
69
71
  object : BottomSheetBehavior.BottomSheetCallback() {
@@ -103,6 +105,8 @@ class TrueSheetView(context: Context) :
103
105
  // Configure Sheet Dialog
104
106
  sheetDialog.apply {
105
107
  setOnShowListener {
108
+
109
+ // Initialize footer y
106
110
  UiThreadUtil.runOnUiThread {
107
111
  footerView?.let {
108
112
  val sheetView = sheetLayout.parent as ViewGroup
@@ -205,6 +209,11 @@ class TrueSheetView(context: Context) :
205
209
  sheetDialog.dismiss()
206
210
  }
207
211
 
212
+ fun setMaxHeight(height: Int) {
213
+ sheetBehavior.maxSheetHeight = height
214
+ sheetBehavior.configure(sizes)
215
+ }
216
+
208
217
  fun setSizes(newSizes: Array<Any>) {
209
218
  sizes = newSizes
210
219
  sheetBehavior.configure(sizes)
@@ -10,6 +10,7 @@ import com.facebook.react.uimanager.annotations.ReactProp
10
10
  import com.lodev09.truesheet.core.DismissEvent
11
11
  import com.lodev09.truesheet.core.PresentEvent
12
12
  import com.lodev09.truesheet.core.SizeChangeEvent
13
+ import com.lodev09.truesheet.core.Utils
13
14
 
14
15
  class TrueSheetViewManager : ViewGroupManager<TrueSheetView>() {
15
16
  override fun getName() = TAG
@@ -28,22 +29,23 @@ class TrueSheetViewManager : ViewGroupManager<TrueSheetView>() {
28
29
  .put(SizeChangeEvent.EVENT_NAME, MapBuilder.of("registrationName", "onSizeChange"))
29
30
  .build()
30
31
 
32
+ @ReactProp(name = "maxHeight")
33
+ fun setMaxHeight(view: TrueSheetView, height: Double) {
34
+ view.setMaxHeight(Utils.toPixel(height))
35
+ }
36
+
31
37
  @ReactProp(name = "sizes")
32
- fun setSizes(view: TrueSheetView, sizes: ReadableArray?) {
33
- if (sizes != null) {
34
- val result = ArrayList<Any>()
35
- for (i in 0 until minOf(sizes.size(), 3)) {
36
- when (sizes.getType(i)) {
37
- ReadableType.Number -> result.add(sizes.getDouble(i))
38
- ReadableType.String -> result.add(sizes.getString(i))
39
- else -> Log.d(TAG, "Invalid type")
40
- }
38
+ fun setSizes(view: TrueSheetView, sizes: ReadableArray) {
39
+ val result = ArrayList<Any>()
40
+ for (i in 0 until minOf(sizes.size(), 3)) {
41
+ when (sizes.getType(i)) {
42
+ ReadableType.Number -> result.add(sizes.getDouble(i))
43
+ ReadableType.String -> result.add(sizes.getString(i))
44
+ else -> Log.d(TAG, "Invalid type")
41
45
  }
42
-
43
- view.setSizes(result.toArray())
44
- } else {
45
- view.setSizes(arrayOf("medium", "large"))
46
46
  }
47
+
48
+ view.setSizes(result.toArray())
47
49
  }
48
50
 
49
51
  companion object {
@@ -8,7 +8,7 @@ import com.facebook.react.bridge.ReactMethod
8
8
  import com.facebook.react.bridge.UiThreadUtil
9
9
  import com.facebook.react.module.annotations.ReactModule
10
10
  import com.facebook.react.uimanager.UIManagerHelper
11
- import com.lodev09.truesheet.utils.withPromise
11
+ import com.lodev09.truesheet.core.Utils
12
12
 
13
13
  @ReactModule(name = TrueSheetViewModule.TAG)
14
14
  class TrueSheetViewModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
@@ -39,7 +39,7 @@ class TrueSheetViewModule(reactContext: ReactApplicationContext) : ReactContextB
39
39
  fun present(tag: Int, index: Int, promise: Promise) {
40
40
  withTrueSheetView(tag) {
41
41
  it.present(index) {
42
- withPromise(promise) {
42
+ Utils.withPromise(promise) {
43
43
  return@withPromise null
44
44
  }
45
45
  }
@@ -50,7 +50,7 @@ class TrueSheetViewModule(reactContext: ReactApplicationContext) : ReactContextB
50
50
  fun dismiss(tag: Int, promise: Promise) {
51
51
  withTrueSheetView(tag) {
52
52
  it.dismiss {
53
- withPromise(promise) {
53
+ Utils.withPromise(promise) {
54
54
  return@withPromise null
55
55
  }
56
56
  }
@@ -26,6 +26,7 @@ class DismissEvent(surfaceId: Int, viewId: Int) : Event<PresentEvent>(surfaceId,
26
26
  }
27
27
  }
28
28
 
29
+ // onSizeChange
29
30
  class SizeChangeEvent(surfaceId: Int, viewId: Int, private val sizeInfo: SizeInfo) : Event<SizeChangeEvent>(surfaceId, viewId) {
30
31
  override fun getEventName() = EVENT_NAME
31
32
 
@@ -5,14 +5,13 @@ import android.view.MotionEvent
5
5
  import android.view.ViewGroup
6
6
  import android.widget.ScrollView
7
7
  import androidx.coordinatorlayout.widget.CoordinatorLayout
8
- import com.facebook.react.uimanager.PixelUtil
9
8
  import com.google.android.material.bottomsheet.BottomSheetBehavior
10
- import com.lodev09.truesheet.utils.toDIP
11
9
 
12
10
  data class SizeInfo(val index: Int, val value: Float)
13
11
 
14
12
  class SheetBehavior<T : ViewGroup> : BottomSheetBehavior<T>() {
15
- var maxSize: Point = Point()
13
+ var maxSheetSize: Point = Point()
14
+ var maxSheetHeight: Int? = null
16
15
 
17
16
  var contentView: ViewGroup? = null
18
17
  var footerView: ViewGroup? = null
@@ -55,49 +54,47 @@ class SheetBehavior<T : ViewGroup> : BottomSheetBehavior<T>() {
55
54
  event.action == MotionEvent.ACTION_CANCEL
56
55
  }
57
56
 
58
- private fun getSizeHeight(size: Any, contentHeight: Int): Int {
59
- val maxHeight = maxSize.y
60
-
57
+ fun getSizeHeight(size: Any, contentHeight: Int): Int {
61
58
  val height =
62
59
  when (size) {
63
- is Double -> PixelUtil.toPixelFromDIP(size).toInt()
60
+ is Double -> Utils.toPixel(size)
64
61
 
65
- is Int -> PixelUtil.toPixelFromDIP(size.toDouble()).toInt()
62
+ is Int -> Utils.toPixel(size.toDouble())
66
63
 
67
64
  is String -> {
68
- return when (size) {
65
+ when (size) {
69
66
  "auto" -> contentHeight
70
67
 
71
- "large" -> maxHeight
68
+ "large" -> maxSheetSize.y
72
69
 
73
- "medium" -> (maxHeight * 0.50).toInt()
70
+ "medium" -> (maxSheetSize.y * 0.50).toInt()
74
71
 
75
- "small" -> (maxHeight * 0.25).toInt()
72
+ "small" -> (maxSheetSize.y * 0.25).toInt()
76
73
 
77
74
  else -> {
78
75
  if (size.endsWith('%')) {
79
76
  val percent = size.trim('%').toDoubleOrNull()
80
- return if (percent == null) {
77
+ if (percent == null) {
81
78
  0
82
79
  } else {
83
- ((percent / 100) * maxHeight).toInt()
80
+ ((percent / 100) * maxSheetSize.y).toInt()
84
81
  }
85
82
  } else {
86
83
  val fixedHeight = size.toDoubleOrNull()
87
- return if (fixedHeight == null) {
84
+ if (fixedHeight == null) {
88
85
  0
89
86
  } else {
90
- PixelUtil.toPixelFromDIP(fixedHeight).toInt()
87
+ Utils.toPixel(fixedHeight)
91
88
  }
92
89
  }
93
90
  }
94
91
  }
95
92
  }
96
93
 
97
- else -> (maxHeight * 0.5).toInt()
94
+ else -> (maxSheetSize.y * 0.5).toInt()
98
95
  }
99
96
 
100
- return minOf(height, maxHeight)
97
+ return minOf(height, maxSheetHeight ?: maxSheetSize.y)
101
98
  }
102
99
 
103
100
  fun configure(sizes: Array<Any>) {
@@ -128,7 +125,7 @@ class SheetBehavior<T : ViewGroup> : BottomSheetBehavior<T>() {
128
125
  isFitToContents = false
129
126
 
130
127
  peekHeight = getSizeHeight(sizes[0], contentHeight)
131
- halfExpandedRatio = getSizeHeight(sizes[1], contentHeight).toFloat() / maxSize.y.toFloat()
128
+ halfExpandedRatio = getSizeHeight(sizes[1], contentHeight).toFloat() / maxSheetSize.y.toFloat()
132
129
  maxHeight = getSizeHeight(sizes[2], contentHeight)
133
130
  }
134
131
  }
@@ -139,29 +136,29 @@ class SheetBehavior<T : ViewGroup> : BottomSheetBehavior<T>() {
139
136
  when (sizeCount) {
140
137
  1 -> {
141
138
  when (state) {
142
- STATE_EXPANDED -> SizeInfo(0, PixelUtil.toDIPFromPixel(maxHeight.toFloat()))
139
+ STATE_EXPANDED -> SizeInfo(0, Utils.toDIP(maxHeight))
143
140
  else -> null
144
141
  }
145
142
  }
146
143
 
147
144
  2 -> {
148
145
  when (state) {
149
- STATE_COLLAPSED -> SizeInfo(0, toDIP(peekHeight))
150
- STATE_EXPANDED -> SizeInfo(1, toDIP(maxHeight))
146
+ STATE_COLLAPSED -> SizeInfo(0, Utils.toDIP(peekHeight))
147
+ STATE_EXPANDED -> SizeInfo(1, Utils.toDIP(maxHeight))
151
148
  else -> null
152
149
  }
153
150
  }
154
151
 
155
152
  3 -> {
156
153
  when (state) {
157
- STATE_COLLAPSED -> SizeInfo(0, toDIP(peekHeight))
154
+ STATE_COLLAPSED -> SizeInfo(0, Utils.toDIP(peekHeight))
158
155
 
159
156
  STATE_HALF_EXPANDED -> {
160
- val height = halfExpandedRatio * maxSize.y
161
- SizeInfo(1, toDIP(height.toInt()))
157
+ val height = halfExpandedRatio * maxSheetSize.y
158
+ SizeInfo(1, Utils.toDIP(height.toInt()))
162
159
  }
163
160
 
164
- STATE_EXPANDED -> SizeInfo(2, toDIP(maxHeight))
161
+ STATE_EXPANDED -> SizeInfo(2, Utils.toDIP(maxHeight))
165
162
 
166
163
  else -> null
167
164
  }
@@ -0,0 +1,58 @@
1
+ package com.lodev09.truesheet.core
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
+ import com.facebook.react.bridge.Promise
9
+ import com.facebook.react.uimanager.PixelUtil
10
+
11
+ object Utils {
12
+ @SuppressLint("DiscouragedApi", "InternalInsetResource")
13
+ fun maxSize(context: Context): Point {
14
+ val minPoint = Point()
15
+ val maxPoint = Point()
16
+ val sizePoint = Point()
17
+
18
+ val wm = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
19
+ val display = Assertions.assertNotNull(wm).defaultDisplay
20
+ // getCurrentSizeRange will return the min and max width and height that the window can be
21
+ display.getCurrentSizeRange(minPoint, maxPoint)
22
+ // getSize will return the dimensions of the screen in its current orientation
23
+ display.getSize(sizePoint)
24
+ val attrs = intArrayOf(android.R.attr.windowFullscreen)
25
+ val theme = context.theme
26
+ val ta = theme.obtainStyledAttributes(attrs)
27
+ val windowFullscreen = ta.getBoolean(0, false)
28
+
29
+ // We need to add the status bar height to the height if we have a fullscreen window,
30
+ // because Display.getCurrentSizeRange doesn't include it.
31
+ val resources = context.resources
32
+ val statusBarId = resources.getIdentifier("status_bar_height", "dimen", "android")
33
+ var statusBarHeight = 0
34
+ if (windowFullscreen && statusBarId > 0) {
35
+ statusBarHeight = resources.getDimension(statusBarId).toInt()
36
+ }
37
+ return if (sizePoint.x < sizePoint.y) {
38
+ // If we are vertical the width value comes from min width and height comes from max height
39
+ Point(minPoint.x, maxPoint.y + statusBarHeight)
40
+ } else {
41
+ // If we are horizontal the width value comes from max width and height comes from min height
42
+ Point(maxPoint.x, minPoint.y + statusBarHeight)
43
+ }
44
+ }
45
+
46
+ fun toDIP(value: Int): Float = PixelUtil.toDIPFromPixel(value.toFloat())
47
+ fun toPixel(value: Double): Int = PixelUtil.toPixelFromDIP(value).toInt()
48
+
49
+ fun withPromise(promise: Promise, closure: () -> Any?) {
50
+ try {
51
+ val result = closure()
52
+ promise.resolve(result)
53
+ } catch (e: Throwable) {
54
+ e.printStackTrace()
55
+ promise.reject("Error", e.message, e.cause)
56
+ }
57
+ }
58
+ }
@@ -14,13 +14,14 @@ extension UISheetPresentationController.Detent.Identifier {
14
14
  @available(iOS 15.0, *)
15
15
  extension UIViewController {
16
16
  private func detentFor(identifier: UISheetPresentationController.Detent.Identifier,
17
+ with maxHeight: CGFloat,
17
18
  _ resolution: @escaping (CGFloat) -> Void) -> UISheetPresentationController.Detent {
18
19
  switch identifier {
19
20
  case .large:
20
21
  if #available(iOS 16.0, *) {
21
22
  return .custom(identifier: .large) { context in
22
- let value = UISheetPresentationController.Detent.large().resolvedValue(in: context)
23
- resolution(value ?? 0)
23
+ let value = min(UISheetPresentationController.Detent.large().resolvedValue(in: context) ?? 0, maxHeight)
24
+ resolution(value)
24
25
  return value
25
26
  }
26
27
  } else {
@@ -30,15 +31,15 @@ extension UIViewController {
30
31
  case .medium:
31
32
  if #available(iOS 16.0, *) {
32
33
  return .custom(identifier: .medium) { context in
33
- let value = UISheetPresentationController.Detent.medium().resolvedValue(in: context)
34
- resolution(value ?? 0)
34
+ let value = min(UISheetPresentationController.Detent.medium().resolvedValue(in: context) ?? 0, maxHeight)
35
+ resolution(value)
35
36
  return value
36
37
  }
37
38
  }
38
39
  case .small:
39
40
  if #available(iOS 16.0, *) {
40
41
  return .custom { context in
41
- let value = 0.25 * context.maximumDetentValue
42
+ let value = min(0.25 * context.maximumDetentValue, maxHeight)
42
43
  resolution(value)
43
44
  return value
44
45
  }
@@ -52,18 +53,21 @@ extension UIViewController {
52
53
  }
53
54
 
54
55
  /// Get the custom detent based on the given size and view frame size
55
- func detentFor(_ anySize: Any, with height: CGFloat?, _ resolution: @escaping (String, CGFloat) -> Void) -> UISheetPresentationController.Detent {
56
+ func detentFor(_ anySize: Any,
57
+ with height: CGFloat?,
58
+ with maxHeight: CGFloat,
59
+ _ resolution: @escaping (String, CGFloat) -> Void) -> UISheetPresentationController.Detent {
56
60
  let id = "custom-\(anySize)"
57
61
 
58
62
  if let floatSize = anySize as? CGFloat {
59
63
  if #available(iOS 16.0, *) {
60
64
  return .custom(identifier: identifier(from: id)) { context in
61
- let value = min(floatSize, context.maximumDetentValue)
65
+ let value = min(floatSize, context.maximumDetentValue, maxHeight)
62
66
  resolution(id, value)
63
67
  return value
64
68
  }
65
69
  } else {
66
- return detentFor(identifier: .medium) { value in
70
+ return detentFor(identifier: .medium, with: maxHeight) { value in
67
71
  resolution(id, value)
68
72
  }
69
73
  }
@@ -72,22 +76,22 @@ extension UIViewController {
72
76
  if var stringSize = anySize as? String {
73
77
  switch stringSize {
74
78
  case "small":
75
- return detentFor(identifier: .small) { value in
79
+ return detentFor(identifier: .small, with: maxHeight) { value in
76
80
  resolution(UISheetPresentationController.Detent.Identifier.small.rawValue, value)
77
81
  }
78
82
  case "medium":
79
- return detentFor(identifier: .medium) { value in
83
+ return detentFor(identifier: .medium, with: maxHeight) { value in
80
84
  resolution(UISheetPresentationController.Detent.Identifier.medium.rawValue, value)
81
85
  }
82
86
  case "large":
83
- return detentFor(identifier: .large) { value in
87
+ return detentFor(identifier: .large, with: maxHeight) { value in
84
88
  resolution(UISheetPresentationController.Detent.Identifier.large.rawValue, value)
85
89
  }
86
90
  default:
87
91
  if #available(iOS 16.0, *) {
88
92
  if stringSize == "auto" {
89
93
  return .custom(identifier: identifier(from: id)) { context in
90
- let value = min(height ?? context.maximumDetentValue / 2, context.maximumDetentValue)
94
+ let value = min(height ?? context.maximumDetentValue / 2, context.maximumDetentValue, maxHeight)
91
95
  resolution(id, value)
92
96
  return value
93
97
  }
@@ -97,21 +101,21 @@ extension UIViewController {
97
101
  let floatSize = CGFloat((stringSize as NSString).floatValue)
98
102
  if floatSize > 0.0 {
99
103
  return .custom(identifier: identifier(from: id)) { context in
100
- let value = min((floatSize / 100) * context.maximumDetentValue, context.maximumDetentValue)
104
+ let value = min((floatSize / 100) * context.maximumDetentValue, context.maximumDetentValue, maxHeight)
101
105
  resolution(id, value)
102
106
  return value
103
107
  }
104
108
  }
105
109
  }
106
110
  } else {
107
- return detentFor(identifier: .medium) { value in
111
+ return detentFor(identifier: .medium, with: maxHeight) { value in
108
112
  resolution(id, value)
109
113
  }
110
114
  }
111
115
  }
112
116
  }
113
117
 
114
- resolution(id, 0)
118
+ resolution(id, view.frame.height / 2)
115
119
  return .medium()
116
120
  }
117
121
 
@@ -10,7 +10,7 @@
10
10
  class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
11
11
  // MARK: - React properties
12
12
 
13
- var sizes: [Any] = ["medium", "large"]
13
+ var maxHeight: CGFloat?
14
14
 
15
15
  // Events
16
16
  @objc var onDismiss: RCTDirectEventBlock?
@@ -150,9 +150,15 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
150
150
 
151
151
  // MARK: - Prop setters
152
152
 
153
+ @objc
154
+ func setMaxHeight(_ height: NSNumber) {
155
+ viewController.maxHeight = CGFloat(height.floatValue)
156
+ configureSheetIfPresented()
157
+ }
158
+
153
159
  @objc
154
160
  func setSizes(_ sizes: [Any]) {
155
- self.sizes = Array(sizes.prefix(3))
161
+ viewController.sizes = Array(sizes.prefix(3))
156
162
  configureSheetIfPresented()
157
163
  }
158
164
 
@@ -171,7 +177,7 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
171
177
  func configureSheetIfPresented() {
172
178
  // Resize sheet
173
179
  if #available(iOS 15.0, *), isPresented {
174
- viewController.configureSheet(for: sizes, at: activeIndex ?? 0, with: contentHeight, nil)
180
+ viewController.configureSheet(at: activeIndex ?? 0, with: contentHeight, nil)
175
181
  }
176
182
  }
177
183
 
@@ -180,6 +186,8 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
180
186
  viewController.dismiss(animated: true) {
181
187
  promise.resolve(nil)
182
188
  }
189
+ } else {
190
+ promise.resolve(nil)
183
191
  }
184
192
  }
185
193
 
@@ -216,13 +224,13 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
216
224
  return
217
225
  }
218
226
 
219
- guard sizes.indices.contains(index) else {
227
+ guard viewController.sizes.indices.contains(index) else {
220
228
  promise.reject(message: "Size at \(index) is not configured.")
221
229
  return
222
230
  }
223
231
 
224
232
  if #available(iOS 15.0, *) {
225
- viewController.configureSheet(for: sizes, at: index, with: contentHeight) {
233
+ viewController.configureSheet(at: index, with: contentHeight) {
226
234
  if self.isPresented {
227
235
  // Notify when size is changed programatically
228
236
  let info = self.viewController.detentValues.first(where: { $0.value.index == index })
@@ -233,7 +241,9 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
233
241
  }
234
242
  }
235
243
 
236
- if !isPresented {
244
+ if isPresented {
245
+ promise.resolve(nil)
246
+ } else {
237
247
  // Keep track of the active index
238
248
  activeIndex = index
239
249
 
@@ -29,6 +29,9 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
29
29
 
30
30
  weak var delegate: TrueSheetViewControllerDelegate?
31
31
 
32
+ var sizes: [Any] = ["medium", "large"]
33
+ var maxHeight: CGFloat?
34
+
32
35
  var lastViewWidth: CGFloat = 0
33
36
  var detentValues: [String: SizeInfo] = [:]
34
37
 
@@ -71,7 +74,7 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
71
74
  /// Prepares the view controller for sheet presentation
72
75
  /// Do nothing on IOS 14 and below... sad
73
76
  @available(iOS 15.0, *)
74
- func configureSheet(for sizes: [Any], at index: Int = 0, with height: CGFloat, _ completion: (() -> Void)?) {
77
+ func configureSheet(at index: Int = 0, with contentHeight: CGFloat, _ completion: (() -> Void)?) {
75
78
  guard let sheet else { return }
76
79
 
77
80
  detentValues = [:]
@@ -79,7 +82,7 @@ class TrueSheetViewController: UIViewController, UISheetPresentationControllerDe
79
82
  var detents: [UISheetPresentationController.Detent] = []
80
83
 
81
84
  for (index, size) in sizes.enumerated() {
82
- let detent = detentFor(size, with: height) { id, value in
85
+ let detent = detentFor(size, with: contentHeight, with: maxHeight ?? view.frame.height) { id, value in
83
86
  self.detentValues[id] = SizeInfo(index: index, value: value)
84
87
  }
85
88
 
@@ -27,11 +27,9 @@ RCT_EXPORT_VIEW_PROPERTY(onPresent, RCTDirectEventBlock)
27
27
  RCT_EXPORT_VIEW_PROPERTY(onDismiss, RCTDirectEventBlock)
28
28
  RCT_EXPORT_VIEW_PROPERTY(onSizeChange, RCTDirectEventBlock)
29
29
 
30
- // Internal Properties
31
- RCT_EXPORT_VIEW_PROPERTY(scrollableHandle, NSNumber*)
32
- RCT_EXPORT_VIEW_PROPERTY(footerHandle, NSNumber*)
33
-
34
30
  // Properties
31
+ RCT_EXPORT_VIEW_PROPERTY(scrollableHandle, NSNumber)
32
+ RCT_EXPORT_VIEW_PROPERTY(maxHeight, NSNumber)
35
33
  RCT_EXPORT_VIEW_PROPERTY(sizes, NSArray)
36
34
 
37
35
  @end
@@ -83,6 +83,7 @@ class TrueSheet extends _react.PureComponent {
83
83
  style: $nativeSheet,
84
84
  scrollableHandle: this.state.scrollableHandle,
85
85
  sizes: this.props.sizes ?? ['medium', 'large'],
86
+ maxHeight: this.props.maxHeight,
86
87
  onPresent: this.onPresent,
87
88
  onDismiss: this.onDismiss,
88
89
  onSizeChange: this.onSizeChange
@@ -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","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,IAAA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AS,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":[]}
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","maxHeight","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,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAA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,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/Cc,SAAS,EAAE,IAAI,CAACjC,KAAK,CAACiC,SAAU;MAChC5B,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,CAAAqE,IAAI;MACHC,WAAW,EAAE,KAAM;MACnBJ,KAAK,EAAE;QAAEK,eAAe,EAAE,IAAI,CAACpC,KAAK,CAACoC,eAAe,IAAI;MAAQ;IAAE,gBAElE1E,MAAA,CAAAW,OAAA,CAAAyD,aAAA,CAACjE,YAAA,CAAAqE,IAAI;MAACC,WAAW,EAAE,KAAM;MAACJ,KAAK,EAAE,IAAI,CAAC/B,KAAK,CAAC+B;IAAM,GAC/C,IAAI,CAAC/B,KAAK,CAACqC,QACR,CAAC,eACP3E,MAAA,CAAAW,OAAA,CAAAyD,aAAA,CAACjE,YAAA,CAAAqE,IAAI;MAACC,WAAW,EAAE;IAAM,GAAE,CAAC,CAACN,eAAe,iBAAInE,MAAA,CAAAW,OAAA,CAAAyD,aAAA,CAACD,eAAe,MAAE,CAAQ,CACtE,CACa,CAAC;EAE1B;AACF;AAACS,OAAA,CAAA1C,SAAA,GAAAA,SAAA;AAED,MAAMoC,YAAuB,GAAG;EAC9BO,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]}
@@ -75,6 +75,7 @@ export class TrueSheet extends PureComponent {
75
75
  style: $nativeSheet,
76
76
  scrollableHandle: this.state.scrollableHandle,
77
77
  sizes: this.props.sizes ?? ['medium', 'large'],
78
+ maxHeight: this.props.maxHeight,
78
79
  onPresent: this.onPresent,
79
80
  onDismiss: this.onDismiss,
80
81
  onSizeChange: this.onSizeChange
@@ -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","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,IAAI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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":[]}
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","maxHeight","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;AAarC,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,C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C/C,IAAI,CAAC5B,KAAK,CAACiC,QACR,CAAC,eACPnD,KAAA,CAAA6C,aAAA,CAACvC,IAAI;MAAC2C,WAAW,EAAE;IAAM,GAAE,CAAC,CAACL,eAAe,iBAAI5C,KAAA,CAAA6C,aAAA,CAACD,eAAe,MAAE,CAAQ,CACtE,CACa,CAAC;EAE1B;AACF;AAEA,MAAMG,YAAuB,GAAG;EAC9BK,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,CAAC;AACX,CAAC","ignoreList":[]}
@@ -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,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
+ {"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;AA8B9D,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;CA0BpB"}
@@ -73,6 +73,10 @@ export interface TrueSheetProps extends ViewProps {
73
73
  * @default ['medium', 'large']
74
74
  */
75
75
  sizes?: SheetSize[];
76
+ /**
77
+ * Overrides `large` or `100%` height.
78
+ */
79
+ maxHeight?: number;
76
80
  /**
77
81
  * A component that floats at the bottom of the Sheet.
78
82
  */
@@ -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,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEzD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS;AACnB;;;;;GAKG;AACD,MAAM;AAER;;;;;GAKG;GACD,MAAM;AAER;;;;;GAKG;GACD,GAAG,MAAM,GAAG;AAEd;;;;;GAKG;GACD,OAAO;AAET;;;;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,CAAC,CAAC,CAAA;IAEzC;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,SAAS,EAAE,CAAA;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;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.0",
3
+ "version": "0.4.0",
4
4
  "description": "The true native bottom sheet. 💩",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -34,7 +34,7 @@
34
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
- "release": "release-it"
37
+ "release": "yarn tidy && release-it"
38
38
  },
39
39
  "keywords": [
40
40
  "react-native",
package/src/TrueSheet.tsx CHANGED
@@ -25,6 +25,7 @@ interface TrueSheetNativeViewProps {
25
25
  scrollableHandle: number | null
26
26
  style: StyleProp<ViewStyle>
27
27
  sizes: TrueSheetProps['sizes']
28
+ maxHeight?: TrueSheetProps['maxHeight']
28
29
  children: ReactNode
29
30
  onDismiss: () => void
30
31
  onPresent: (event: NativeSyntheticEvent<{ index: number }>) => void
@@ -131,6 +132,7 @@ export class TrueSheet extends PureComponent<TrueSheetProps, TrueSheetState> {
131
132
  style={$nativeSheet}
132
133
  scrollableHandle={this.state.scrollableHandle}
133
134
  sizes={this.props.sizes ?? ['medium', 'large']}
135
+ maxHeight={this.props.maxHeight}
134
136
  onPresent={this.onPresent}
135
137
  onDismiss={this.onDismiss}
136
138
  onSizeChange={this.onSizeChange}
package/src/types.ts CHANGED
@@ -84,6 +84,11 @@ export interface TrueSheetProps extends ViewProps {
84
84
  */
85
85
  sizes?: SheetSize[]
86
86
 
87
+ /**
88
+ * Overrides `large` or `100%` height.
89
+ */
90
+ maxHeight?: number
91
+
87
92
  /**
88
93
  * A component that floats at the bottom of the Sheet.
89
94
  */
@@ -1,49 +0,0 @@
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
- }
@@ -1,5 +0,0 @@
1
- package com.lodev09.truesheet.utils
2
-
3
- import com.facebook.react.uimanager.PixelUtil
4
-
5
- fun toDIP(value: Int): Float = PixelUtil.toDIPFromPixel(value.toFloat())
@@ -1,13 +0,0 @@
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
- }