@lodev09/react-native-true-sheet 0.11.1 → 0.11.2

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.
@@ -40,6 +40,15 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val
40
40
  var footerHeight = 0
41
41
  var maxSheetHeight: Int? = null
42
42
 
43
+ var dismissible: Boolean = true
44
+ set(value) {
45
+ field = value
46
+ setCanceledOnTouchOutside(value)
47
+ setCancelable(value)
48
+
49
+ behavior.isHideable = value
50
+ }
51
+
43
52
  var footerView: ViewGroup? = null
44
53
 
45
54
  var sizes: Array<Any> = arrayOf("medium", "large")
@@ -81,7 +90,7 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val
81
90
  WindowManager.LayoutParams.FLAG_DIM_BEHIND
82
91
  )
83
92
 
84
- setCanceledOnTouchOutside(true)
93
+ setCanceledOnTouchOutside(dismissible)
85
94
  } else {
86
95
  // Override the background touch and pass it to the components outside
87
96
  view.setOnTouchListener { v, event ->
@@ -101,7 +110,7 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val
101
110
  /**
102
111
  * Present the sheet.
103
112
  */
104
- fun show(sizeIndex: Int) {
113
+ fun present(sizeIndex: Int) {
105
114
  setupDimmedBackground(sizeIndex)
106
115
  if (isShowing) {
107
116
  setStateForSizeIndex(sizeIndex)
@@ -253,7 +253,7 @@ class TrueSheetView(context: Context) :
253
253
  }
254
254
 
255
255
  fun setDismissible(dismissible: Boolean) {
256
- sheetDialog.setCancelable(dismissible)
256
+ sheetDialog.dismissible = dismissible
257
257
  }
258
258
 
259
259
  fun setSizes(newSizes: Array<Any>) {
@@ -270,7 +270,7 @@ class TrueSheetView(context: Context) :
270
270
  }
271
271
 
272
272
  presentPromise = promiseCallback
273
- sheetDialog.show(sizeIndex)
273
+ sheetDialog.present(sizeIndex)
274
274
  }
275
275
 
276
276
  /**
@@ -278,10 +278,7 @@ class TrueSheetView(context: Context) :
278
278
  */
279
279
  fun dismiss(promiseCallback: () -> Unit) {
280
280
  dismissPromise = promiseCallback
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
281
+ sheetDialog.dismiss()
285
282
  }
286
283
 
287
284
  companion object {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodev09/react-native-true-sheet",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
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",