@lodev09/react-native-true-sheet 0.11.0 → 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.
package/README.md CHANGED
@@ -9,25 +9,29 @@ The true native bottom sheet experience for your React Native Apps. 💩
9
9
  <img alt="React Native True Sheet" src="docs/static/img/preview.gif" width="600px" />
10
10
 
11
11
  ## Features
12
- * ✅ Implemented in the native realm.
13
- * **_NOT_** your pure JS, (re)animated view (might integrate in the future 👀)
14
- * Clean, fast, and lightweight.
15
- * Handles your _Scrolling_ needs, natively.
16
- * Handles your _Footer_ needs, natively.
17
- * ✅ Handles your _Keyboard_ needs, natively.
18
- * ✅ Asynchronus `ref` [methods](https://sheet.lodev09.com/reference/methods#ref-methods).
19
- * ✅ Bonus! [Blur](https://sheet.lodev09.com/reference/types#blurtint) support on IOS 😎
12
+
13
+ * Implemented in the native realm.
14
+ * Clean, fast, and lightweight.
15
+ * Asynchronus `ref` [methods](https://sheet.lodev09.com/reference/methods#ref-methods).
16
+ * Bonus! [Blur](https://sheet.lodev09.com/reference/types#blurtint) support on IOS 😎
20
17
 
21
18
  ## Installation
22
19
 
20
+ You can install the package by using either `yarn` or `npm`.
21
+
23
22
  ```sh
24
23
  yarn add @lodev09/react-native-true-sheet
25
24
  ```
26
-
27
25
  ```sh
28
26
  npm i @lodev09/react-native-true-sheet
29
27
  ```
30
28
 
29
+ Next, run the following to install it on IOS.
30
+
31
+ ```sh
32
+ cd ios && pod install
33
+ ```
34
+
31
35
  ## Documentation
32
36
 
33
37
  - [Guides](https://sheet.lodev09.com/category/guides)
@@ -69,15 +73,10 @@ export const App = () => {
69
73
  }
70
74
  ```
71
75
 
72
- ## TODO (v1)
73
-
74
- - [ ] Test with RN new architecture
75
- - [ ] Reanimated integration(?)
76
-
77
76
  ## Contributing
78
77
 
79
78
  See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
80
79
 
81
80
  ## License
82
81
 
83
- MIT
82
+ [MIT](LICENSE)
@@ -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 {
@@ -7,3 +7,6 @@
7
7
  //
8
8
 
9
9
  #import <React/RCTViewManager.h>
10
+ #import <React/RCTUIManager.h>
11
+ #import <React/RCTTouchHandler.h>
12
+ #import <React/RCTScrollView.h>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodev09/react-native-true-sheet",
3
- "version": "0.11.0",
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",
@@ -48,7 +48,7 @@
48
48
  "type": "git",
49
49
  "url": "git+https://github.com/lodev09/react-native-true-sheet.git"
50
50
  },
51
- "author": "lodev09 <lodev09@gmail.com> (https://github.com/lodev09)",
51
+ "author": "Jovanni Lo <lodev09@gmail.com> (https://github.com/lodev09)",
52
52
  "license": "MIT",
53
53
  "bugs": {
54
54
  "url": "https://github.com/lodev09/react-native-true-sheet/issues"