@lodev09/react-native-true-sheet 0.2.1 → 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.
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodev09/react-native-true-sheet",
3
- "version": "0.2.1",
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",
@@ -127,6 +127,9 @@
127
127
  },
128
128
  "eslintConfig": {
129
129
  "root": true,
130
+ "ignorePatterns": [
131
+ "lib"
132
+ ],
130
133
  "extends": [
131
134
  "plugin:@typescript-eslint/recommended",
132
135
  "eslint:recommended",