one 2.0.0-beta.102.1 → 2.0.0-beta.103.1

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.
@@ -11,7 +11,6 @@ private final class GlassModel: ObservableObject {
11
11
  private struct GlassContent: View {
12
12
  @ObservedObject var model: GlassModel
13
13
  @ObservedObject var children: OneNativeChildren
14
- let standalone: Bool
15
14
 
16
15
  var body: some View {
17
16
  VStack(alignment: .leading, spacing: 0) {
@@ -21,9 +20,6 @@ private struct GlassContent: View {
21
20
  .oneNativeStyle(model.style)
22
21
  // outside the style chain, so the glass surface draws in it along with the children.
23
22
  .oneNativeColorScheme(model.colorScheme)
24
- // standalone, React Native already placed the box, so insets the hosting controller
25
- // inherits from the screen would only shrink the surface inside it.
26
- .ignoresSafeArea(edges: standalone ? .all : [])
27
23
  }
28
24
  }
29
25
 
@@ -36,8 +32,8 @@ public final class OneNativeGlassView: OneNativeContainerView {
36
32
  public init() {
37
33
  let model = GlassModel()
38
34
  self.model = model
39
- super.init(wrap: { children, standalone in
40
- AnyView(GlassContent(model: model, children: children, standalone: standalone))
35
+ super.init(wrap: { children, _ in
36
+ AnyView(GlassContent(model: model, children: children))
41
37
  })
42
38
  }
43
39
 
@@ -4,6 +4,20 @@ import UIKit
4
4
  final class OneNativeHostingController<Content: View>: UIHostingController<Content> {
5
5
  var isAttached: Bool { view.superview != nil }
6
6
 
7
+ // react native placed the host's box, so by default the hosted view ignores the insets
8
+ // it would inherit from the screen. uikit computes them from where the box sits when it
9
+ // lays out, and a transform moving the box never lays it out again: a control that
10
+ // mounts under the status bar (a toast entering from off screen) keeps its content
11
+ // inset out of the box. screen chrome that sits against those edges (a navigation
12
+ // stack's bar, a tab bar, a sheet) passes screenInsets to keep them.
13
+ init(rootView: Content, screenInsets: Bool = false) {
14
+ super.init(rootView: rootView)
15
+ if !screenInsets { safeAreaRegions = [] }
16
+ }
17
+
18
+ @available(*, unavailable)
19
+ required init?(coder: NSCoder) { fatalError("init(coder:) is not supported") }
20
+
7
21
  // the parent is the view controller whose view is the nearest ancestor of the host,
8
22
  // the first view controller on the responder chain: uikit resolves that same
9
23
  // controller when the hosted view is added and raises
@@ -128,7 +128,7 @@ public final class OneNativeNavigationStackView: UIView, OneNativeToolbarHost {
128
128
  if controller == nil {
129
129
  model.onSDKEvent = { [weak self] name, value in self?.onSDKEvent?(name, value) }
130
130
  controller = OneNativeHostingController(
131
- rootView: OneNativeNavigationStackRoot(model: model, host: self))
131
+ rootView: OneNativeNavigationStackRoot(model: model, host: self), screenInsets: true)
132
132
  }
133
133
  controller?.attach(to: self)
134
134
  let attached = controller?.isAttached == true
@@ -167,7 +167,7 @@ final class OneNativeSheetModel: ObservableObject {
167
167
  self?.onDetentChange?(type, value, count, revision)
168
168
  }
169
169
  model.onDismiss = { [weak self] revision in self?.onDismiss?(revision) }
170
- controller = OneNativeHostingController(rootView: OneNativeSheetRoot(model: model))
170
+ controller = OneNativeHostingController(rootView: OneNativeSheetRoot(model: model), screenInsets: true)
171
171
  }
172
172
  controller?.attach(to: self)
173
173
  model.active = controller?.isAttached == true
@@ -348,7 +348,7 @@ public final class OneNativeTabsView: UIView, OneNativeToolbarHost {
348
348
  model.onAction = { [weak self] id in self?.onAction?(id) }
349
349
  model.onCustomization = { [weak self] json in self?.onCustomization?(json) }
350
350
  model.onSDKEvent = { [weak self] name, value in self?.onSDKEvent?(name, value) }
351
- controller = OneNativeHostingController(rootView: TabsContent(model: model, host: self))
351
+ controller = OneNativeHostingController(rootView: TabsContent(model: model, host: self), screenInsets: true)
352
352
  }
353
353
  controller?.attach(to: self)
354
354
  model.active = controller?.isAttached == true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "one",
3
- "version": "2.0.0-beta.102.1",
3
+ "version": "2.0.0-beta.103.1",
4
4
  "description": "One is a React framework for web, iOS, and Android apps.",
5
5
  "license": "BSD-3-Clause",
6
6
  "sideEffects": [
@@ -207,18 +207,18 @@
207
207
  "@react-navigation/native-stack": "~8.0.0-alpha.52",
208
208
  "@react-navigation/routers": "~8.0.0-alpha.17",
209
209
  "@ungap/structured-clone": "^1.2.0",
210
- "@vxrn/color-scheme": "2.0.0-beta.102.1",
211
- "@vxrn/compiler": "2.0.0-beta.102.1",
212
- "@vxrn/resolve": "2.0.0-beta.102.1",
213
- "@vxrn/tslib-lite": "2.0.0-beta.102.1",
214
- "@vxrn/use-isomorphic-layout-effect": "2.0.0-beta.102.1",
215
- "@vxrn/utils": "2.0.0-beta.102.1",
216
- "@vxrn/vite-plugin-metro": "2.0.0-beta.102.1",
210
+ "@vxrn/color-scheme": "2.0.0-beta.103.1",
211
+ "@vxrn/compiler": "2.0.0-beta.103.1",
212
+ "@vxrn/resolve": "2.0.0-beta.103.1",
213
+ "@vxrn/tslib-lite": "2.0.0-beta.103.1",
214
+ "@vxrn/use-isomorphic-layout-effect": "2.0.0-beta.103.1",
215
+ "@vxrn/utils": "2.0.0-beta.103.1",
216
+ "@vxrn/vite-plugin-metro": "2.0.0-beta.103.1",
217
217
  "babel-dead-code-elimination": "1.0.10",
218
218
  "babel-plugin-module-resolver": "^5.0.2",
219
219
  "citty": "^0.1.6",
220
220
  "core-js": "^3.38.1",
221
- "create-vxrn": "2.0.0-beta.102.1",
221
+ "create-vxrn": "2.0.0-beta.103.1",
222
222
  "escape-string-regexp": "^5.0.0",
223
223
  "fast-deep-equal": "^3.1.3",
224
224
  "fast-glob": "^3.3.3",
@@ -240,7 +240,7 @@
240
240
  "tsconfig-paths": "^4",
241
241
  "use-latest-callback": "^0.2.3",
242
242
  "vite": "^8.2.2",
243
- "vxrn": "2.0.0-beta.102.1",
243
+ "vxrn": "2.0.0-beta.103.1",
244
244
  "web-streams-polyfill": "^4.3.0",
245
245
  "ws": "^8.21.0",
246
246
  "xxhashjs": "^0.2.2"