@lodev09/react-native-true-sheet 0.2.0 → 0.2.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
@@ -1,12 +1,16 @@
1
1
  # React Native True Sheet
2
2
 
3
- The real native bottom sheet.
3
+ [![CI](https://github.com/lodev09/react-native-true-sheet/actions/workflows/ci.yml/badge.svg)](https://github.com/lodev09/react-native-true-sheet/actions/workflows/ci.yml)
4
+ ![GitHub Release](https://img.shields.io/github/v/release/lodev09/react-native-true-sheet)
5
+ ![NPM Downloads](https://img.shields.io/npm/dw/%40lodev09%2Freact-native-true-sheet)
6
+
7
+ The true native bottom sheet.
4
8
 
5
9
  ## Features
6
- - ✅ Implemented on the native realm.
7
- - ✅ **_NOT_** your pure JS, (re)animated View.
8
- - ✅ Clean, fast and lightweight.
9
- - ✅ Handles your Sscrolling needs, easy.
10
+ * ✅ Implemented on the native realm.
11
+ * ✅ **_NOT_** your pure JS, (re)animated View.
12
+ * ✅ Clean, fast and lightweight.
13
+ * ✅ Handles your Sscrolling needs, easy.
10
14
 
11
15
  ## Installation
12
16
 
package/TrueSheet.podspec CHANGED
@@ -36,7 +36,6 @@ Pod::Spec.new do |s|
36
36
  s.dependency "RCT-Folly"
37
37
  s.dependency "RCTRequired"
38
38
  s.dependency "RCTTypeSafety"
39
- s.dependency "ReactCommon/turbomodule/core"
40
39
  end
41
40
  end
42
41
  end
@@ -62,6 +62,10 @@ extension UIViewController {
62
62
  resolution(id, value)
63
63
  return value
64
64
  }
65
+ } else {
66
+ return detentFor(identifier: .medium) { value in
67
+ resolution(id, value)
68
+ }
65
69
  }
66
70
  }
67
71
 
@@ -79,30 +83,35 @@ extension UIViewController {
79
83
  return detentFor(identifier: .large) { value in
80
84
  resolution(UISheetPresentationController.Detent.Identifier.large.rawValue, value)
81
85
  }
82
- case "auto":
83
- if #available(iOS 16.0, *), let height {
84
- return .custom(identifier: identifier(from: id)) { context in
85
- let value = min(height, context.maximumDetentValue)
86
- resolution(id, value)
87
- return value
88
- }
89
- }
90
86
  default:
91
87
  if #available(iOS 16.0, *) {
92
- // Percent
93
- stringSize.removeAll(where: { $0 == "%" })
94
- let floatSize = CGFloat((stringSize as NSString).floatValue)
95
- if floatSize > 0.0 {
88
+ if stringSize == "auto" {
96
89
  return .custom(identifier: identifier(from: id)) { context in
97
- let value = min((floatSize / 100) * context.maximumDetentValue, context.maximumDetentValue)
90
+ let value = min(height ?? context.maximumDetentValue / 2, context.maximumDetentValue)
98
91
  resolution(id, value)
99
92
  return value
100
93
  }
94
+ } else {
95
+ // Percent
96
+ stringSize.removeAll(where: { $0 == "%" })
97
+ let floatSize = CGFloat((stringSize as NSString).floatValue)
98
+ if floatSize > 0.0 {
99
+ return .custom(identifier: identifier(from: id)) { context in
100
+ let value = min((floatSize / 100) * context.maximumDetentValue, context.maximumDetentValue)
101
+ resolution(id, value)
102
+ return value
103
+ }
104
+ }
105
+ }
106
+ } else {
107
+ return detentFor(identifier: .medium) { value in
108
+ resolution(id, value)
101
109
  }
102
110
  }
103
111
  }
104
112
  }
105
113
 
114
+ resolution(id, 0)
106
115
  return .medium()
107
116
  }
108
117
 
@@ -194,14 +194,15 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
194
194
 
195
195
  // Pin footer at the bottom
196
196
  if let footerView {
197
- containerView.bringSubviewToFront(footerView)
198
197
  if let footerContent = footerView.subviews.first {
198
+ containerView.bringSubviewToFront(footerView)
199
199
  footerView.pinTo(
200
200
  view: viewController.view,
201
201
  from: [.bottom, .left, .right],
202
202
  with: footerContent.bounds.height
203
203
  )
204
204
  } else {
205
+ containerView.sendSubviewToBack(footerView)
205
206
  footerView.removeConstraints(footerView.constraints)
206
207
  }
207
208
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodev09/react-native-true-sheet",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "The true native bottom sheet. 💩",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -78,7 +78,6 @@
78
78
  "react-native": "^0.73.5",
79
79
  "react-native-builder-bob": "^0.23.2",
80
80
  "release-it": "^17.1.1",
81
- "turbo": "^1.12.5",
82
81
  "typescript": "~5.3.3"
83
82
  },
84
83
  "resolutions": {
@@ -128,6 +127,9 @@
128
127
  },
129
128
  "eslintConfig": {
130
129
  "root": true,
130
+ "ignorePatterns": [
131
+ "lib"
132
+ ],
131
133
  "extends": [
132
134
  "plugin:@typescript-eslint/recommended",
133
135
  "eslint:recommended",