@expo/ui 55.0.1 → 55.0.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.
Files changed (144) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/CONTRIBUTING.md +30 -0
  3. package/android/build.gradle +2 -2
  4. package/android/src/main/java/expo/modules/ui/DatePickerView.kt +90 -7
  5. package/android/src/main/java/expo/modules/ui/HorizontalFloatingToolbarView.kt +21 -8
  6. package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +105 -39
  7. package/android/src/main/java/expo/modules/ui/RNHostView.kt +204 -50
  8. package/android/src/main/java/expo/modules/ui/SwitchView.kt +70 -4
  9. package/android/src/main/java/expo/modules/ui/button/IconButton.kt +7 -1
  10. package/android/src/main/java/expo/modules/ui/convertibles/AnimatableFloat.kt +26 -0
  11. package/android/src/main/java/expo/modules/ui/convertibles/AnimationSpecParams.kt +93 -0
  12. package/android/src/main/java/expo/modules/ui/convertibles/GraphicsLayerParams.kt +24 -0
  13. package/build/jetpack-compose/DatePicker/index.d.ts +99 -0
  14. package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
  15. package/build/jetpack-compose/Spacer/index.d.ts +2 -2
  16. package/build/jetpack-compose/Switch/index.d.ts +18 -0
  17. package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
  18. package/build/jetpack-compose/modifiers/animation.d.ts +44 -0
  19. package/build/jetpack-compose/modifiers/animation.d.ts.map +1 -0
  20. package/build/jetpack-compose/modifiers/index.d.ts +50 -3
  21. package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
  22. package/build/swift-ui/AccessoryWidgetBackground/index.d.ts +4 -0
  23. package/build/swift-ui/AccessoryWidgetBackground/index.d.ts.map +1 -0
  24. package/build/swift-ui/ConfirmationDialog/index.d.ts.map +1 -1
  25. package/build/swift-ui/ContextMenu/index.d.ts.map +1 -1
  26. package/build/swift-ui/ControlGroup/index.d.ts +29 -0
  27. package/build/swift-ui/ControlGroup/index.d.ts.map +1 -0
  28. package/build/swift-ui/Gauge/index.d.ts.map +1 -1
  29. package/build/swift-ui/Image/index.d.ts +7 -1
  30. package/build/swift-ui/Image/index.d.ts.map +1 -1
  31. package/build/swift-ui/Label/index.d.ts.map +1 -1
  32. package/build/swift-ui/LabeledContent/index.d.ts.map +1 -1
  33. package/build/swift-ui/Menu/index.d.ts.map +1 -1
  34. package/build/swift-ui/Picker/index.d.ts.map +1 -1
  35. package/build/swift-ui/Popover/index.d.ts.map +1 -1
  36. package/build/swift-ui/Section/index.d.ts.map +1 -1
  37. package/build/swift-ui/Slider/index.d.ts.map +1 -1
  38. package/build/swift-ui/SlotView.d.ts +5 -0
  39. package/build/swift-ui/SlotView.d.ts.map +1 -0
  40. package/build/swift-ui/index.d.ts +2 -0
  41. package/build/swift-ui/index.d.ts.map +1 -1
  42. package/build/swift-ui/modifiers/index.d.ts +33 -1
  43. package/build/swift-ui/modifiers/index.d.ts.map +1 -1
  44. package/expo-module.config.json +1 -1
  45. package/ios/AccessoryWidgetBackgroundView.swift +27 -0
  46. package/ios/ConfirmationDialog/ConfirmationDialog.swift +3 -9
  47. package/ios/ConfirmationDialog/ConfirmationDialogProps.swift +0 -5
  48. package/ios/ContextMenu/ContextMenu.swift +27 -22
  49. package/ios/ContextMenu/ContextMenuRecords.swift +0 -6
  50. package/ios/ControlGroupView.swift +33 -0
  51. package/ios/ExpoUIModule.swift +10 -32
  52. package/ios/GaugeView.swift +4 -26
  53. package/ios/HostView.swift +1 -2
  54. package/ios/ImageView.swift +22 -11
  55. package/ios/Label.swift +2 -17
  56. package/ios/LabeledContentView.swift +3 -27
  57. package/ios/Menu/MenuRecords.swift +0 -2
  58. package/ios/Menu/MenuView.swift +2 -5
  59. package/ios/Modifiers/ResizableModifier.swift +24 -0
  60. package/ios/Modifiers/Rotation3DEffectModifier.swift +20 -0
  61. package/ios/Modifiers/View+ModifierArray.swift +29 -0
  62. package/ios/Modifiers/ViewModifierRegistry.swift +29 -3
  63. package/ios/Modifiers/WidgetModifiers.swift +46 -0
  64. package/ios/Picker/PickerView.swift +2 -6
  65. package/ios/Popover/PopoverProps.swift +0 -4
  66. package/ios/Popover/PopoverView.swift +2 -6
  67. package/ios/RNHostView.swift +91 -10
  68. package/ios/SectionView.swift +6 -12
  69. package/ios/SecureFieldView.swift +0 -1
  70. package/ios/ShareLink/ShareLinkView.swift +1 -1
  71. package/ios/SliderView.swift +10 -27
  72. package/ios/SlotView.swift +38 -0
  73. package/ios/TextFieldView.swift +0 -1
  74. package/ios/UIBaseView.swift +34 -3
  75. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.1/expo.modules.ui-55.0.1-sources.jar → 55.0.2/expo.modules.ui-55.0.2-sources.jar} +0 -0
  76. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.md5 +1 -0
  77. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha1 +1 -0
  78. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha256 +1 -0
  79. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha512 +1 -0
  80. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar +0 -0
  81. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.md5 +1 -0
  82. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha1 +1 -0
  83. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha256 +1 -0
  84. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha512 +1 -0
  85. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.1/expo.modules.ui-55.0.1.module → 55.0.2/expo.modules.ui-55.0.2.module} +22 -22
  86. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.md5 +1 -0
  87. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha1 +1 -0
  88. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha256 +1 -0
  89. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha512 +1 -0
  90. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.1/expo.modules.ui-55.0.1.pom → 55.0.2/expo.modules.ui-55.0.2.pom} +1 -1
  91. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.md5 +1 -0
  92. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha1 +1 -0
  93. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha256 +1 -0
  94. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha512 +1 -0
  95. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
  96. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
  97. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
  98. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
  99. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
  100. package/package.json +2 -2
  101. package/src/jetpack-compose/DatePicker/index.tsx +106 -2
  102. package/src/jetpack-compose/Spacer/index.tsx +2 -2
  103. package/src/jetpack-compose/Switch/index.tsx +18 -0
  104. package/src/jetpack-compose/modifiers/animation.ts +37 -0
  105. package/src/jetpack-compose/modifiers/index.ts +60 -4
  106. package/src/swift-ui/AccessoryWidgetBackground/index.tsx +12 -0
  107. package/src/swift-ui/ConfirmationDialog/index.tsx +4 -12
  108. package/src/swift-ui/ContextMenu/index.tsx +6 -20
  109. package/src/swift-ui/ControlGroup/index.tsx +59 -0
  110. package/src/swift-ui/Gauge/index.tsx +5 -20
  111. package/src/swift-ui/Image/index.tsx +7 -1
  112. package/src/swift-ui/Label/index.tsx +2 -5
  113. package/src/swift-ui/LabeledContent/index.tsx +3 -12
  114. package/src/swift-ui/Menu/index.tsx +2 -6
  115. package/src/swift-ui/Picker/index.tsx +4 -11
  116. package/src/swift-ui/Popover/index.tsx +3 -12
  117. package/src/swift-ui/Section/index.tsx +4 -9
  118. package/src/swift-ui/Slider/index.tsx +4 -12
  119. package/src/swift-ui/SlotView.tsx +8 -0
  120. package/src/swift-ui/index.tsx +2 -0
  121. package/src/swift-ui/modifiers/index.ts +47 -1
  122. package/ios/ConfirmationDialog/ConfirmationDialogComponents.swift +0 -26
  123. package/ios/ContextMenu/ContextMenuComponents.swift +0 -37
  124. package/ios/Menu/MenuComponents.swift +0 -12
  125. package/ios/Picker/PickerComponents.swift +0 -24
  126. package/ios/Popover/PopoverComponents.swift +0 -18
  127. package/ios/SectionComponents.swift +0 -34
  128. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.md5 +0 -1
  129. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha1 +0 -1
  130. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha256 +0 -1
  131. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha512 +0 -1
  132. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar +0 -0
  133. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.md5 +0 -1
  134. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha1 +0 -1
  135. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha256 +0 -1
  136. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha512 +0 -1
  137. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.md5 +0 -1
  138. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha1 +0 -1
  139. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha256 +0 -1
  140. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha512 +0 -1
  141. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.md5 +0 -1
  142. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha1 +0 -1
  143. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha256 +0 -1
  144. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha512 +0 -1
@@ -780,7 +780,6 @@ internal struct ListRowBackground: ViewModifier, Record {
780
780
  }
781
781
  }
782
782
 
783
-
784
783
  internal enum VerticalEdgeOptions: String, Enumerable {
785
784
  case all
786
785
  case top
@@ -1106,7 +1105,7 @@ internal enum AxisOptions: String, Enumerable {
1106
1105
  case horizontal
1107
1106
  case vertical
1108
1107
  case both
1109
-
1108
+
1110
1109
  func toAxis() -> Axis.Set {
1111
1110
  switch self {
1112
1111
  case .vertical:
@@ -1307,7 +1306,7 @@ public class ViewModifierRegistry {
1307
1306
  }
1308
1307
 
1309
1308
  /**
1310
- * Applies `Text returning modifiers. Useful for Text concatenation in TextView.
1309
+ * Applies Text returning modifiers. Useful for Text concatenation in TextView.
1311
1310
  */
1312
1311
  func applyTextModifier(
1313
1312
  _ type: String,
@@ -1353,6 +1352,29 @@ public class ViewModifierRegistry {
1353
1352
  }
1354
1353
  }
1355
1354
 
1355
+ /**
1356
+ * Applies Image returning modifiers.
1357
+ */
1358
+ func applyImageModifier(
1359
+ _ type: String,
1360
+ to image: Image,
1361
+ appContext: AppContext,
1362
+ params: [String: Any]
1363
+ ) -> Image {
1364
+ switch type {
1365
+ case "resizable":
1366
+ guard let modifier = try? ResizableModifier(from: params, appContext: appContext)
1367
+ else { return image.resizable() }
1368
+ return image.resizable(capInsets: EdgeInsets(top: modifier.top, leading: modifier.leading, bottom: modifier.bottom, trailing: modifier.trailing), resizingMode: modifier.resizingMode.toResizingMode)
1369
+ default:
1370
+ #if DEBUG
1371
+ return image
1372
+ #else
1373
+ return image
1374
+ #endif
1375
+ }
1376
+ }
1377
+
1356
1378
  /**
1357
1379
  * Checks if a modifier type is registered.
1358
1380
  */
@@ -1500,6 +1522,10 @@ extension ViewModifierRegistry {
1500
1522
  return try RotationEffectModifier(from: params, appContext: appContext)
1501
1523
  }
1502
1524
 
1525
+ register("rotation3DEffect") { params, appContext, _ in
1526
+ return try Rotation3DEffectModifier(from: params, appContext: appContext)
1527
+ }
1528
+
1503
1529
  register("offset") { params, appContext, _ in
1504
1530
  return try OffsetModifier(from: params, appContext: appContext)
1505
1531
  }
@@ -0,0 +1,46 @@
1
+ // Copyright 2015-present 650 Industries. All rights reserved.
2
+
3
+ import ExpoModulesCore
4
+ import SwiftUI
5
+ #if !os(tvOS)
6
+ import WidgetKit
7
+ #endif
8
+
9
+ internal enum WidgetAccentedRenderingModeOptions: String, Enumerable {
10
+ case accented
11
+ case desaturated
12
+ case accentedDesaturated
13
+ case fullColor
14
+
15
+ #if !os(tvOS)
16
+ @available(iOS 18.0, *)
17
+ var toWidgetAccentedRenderingMode: WidgetAccentedRenderingMode {
18
+ switch self {
19
+ case .accented: return .accented
20
+ case .accentedDesaturated: return .accentedDesaturated
21
+ case .desaturated: return .desaturated
22
+ case .fullColor: return .fullColor
23
+ }
24
+ }
25
+ #endif
26
+ }
27
+
28
+ /**
29
+ * This is a unique modifier that exists only on Image, but returns some View, and for this reason it cannot be a ViewModifier.
30
+ */
31
+ internal struct WidgetAccentedRenderingModeModifier: Record {
32
+ @Field var renderingMode: WidgetAccentedRenderingModeOptions?
33
+
34
+ @ViewBuilder
35
+ func apply(to image: Image) -> some View {
36
+ #if !os(tvOS)
37
+ if #available(iOS 18.0, *), renderingMode != nil {
38
+ image.widgetAccentedRenderingMode(renderingMode?.toWidgetAccentedRenderingMode)
39
+ } else {
40
+ image
41
+ }
42
+ #else
43
+ image
44
+ #endif
45
+ }
46
+ }
@@ -24,13 +24,9 @@ internal struct PickerView: ExpoSwiftUI.View {
24
24
 
25
25
  @ViewBuilder
26
26
  private func makePicker() -> some View {
27
- let content = (props.children?
28
- .compactMap { $0.childView as? PickerContentView }
29
- .first)
27
+ let content = props.children?.slot("content")
30
28
 
31
- let labelContent = props.children?
32
- .compactMap { $0.childView as? PickerLabelView }
33
- .first
29
+ let labelContent = props.children?.slot("label")
34
30
 
35
31
  if let systemImage = props.systemImage, let label = props.label {
36
32
  Picker(label, systemImage: systemImage, selection: $selection) { content }
@@ -8,10 +8,6 @@ internal class PopoverViewProps: UIBaseViewProps {
8
8
  @Field var arrowEdge: PopoverArrowEdgeOption?
9
9
  }
10
10
 
11
- internal final class PopoverViewContentPorps: ExpoSwiftUI.ViewProps {}
12
-
13
- internal final class PopoverViewPopContentPorps: ExpoSwiftUI.ViewProps {}
14
-
15
11
  internal enum PopoverAttachmentAnchorOption: String, Enumerable {
16
12
  case top
17
13
  case center
@@ -45,18 +45,14 @@ internal struct PopoverView: ExpoSwiftUI.View {
45
45
 
46
46
  @ViewBuilder
47
47
  private var triggerContent: some View {
48
- if let content = props.children?
49
- .compactMap({ $0.childView as? PopoverViewContent })
50
- .first {
48
+ if let content = props.children?.slot("trigger") {
51
49
  content
52
50
  }
53
51
  }
54
52
 
55
53
  @ViewBuilder
56
54
  private var popoverContent: some View {
57
- if let content = props.children?
58
- .compactMap({ $0.childView as? PopoverViewPopContent })
59
- .first {
55
+ if let content = props.children?.slot("popover") {
60
56
  content
61
57
  }
62
58
  }
@@ -1,21 +1,102 @@
1
1
  // Copyright 2015-present 650 Industries. All rights reserved.
2
2
 
3
+ import SwiftUI
3
4
  import ExpoModulesCore
4
5
 
5
- public final class RNHostView: ExpoView, ExpoSwiftUI.RNHostViewProtocol {
6
- public required init(appContext: AppContext? = nil) {
7
- super.init(appContext: appContext)
8
- ExpoUITouchHandlerHelper.createAndAttachTouchHandler(for: self)
6
+ internal final class RNHostViewProps: ExpoSwiftUI.ViewProps {
7
+ @Field var matchContents: Bool = false
8
+ }
9
+
10
+ struct RNHostView: ExpoSwiftUI.View {
11
+
12
+ @ObservedObject var props: RNHostViewProps
13
+
14
+ var body: some View {
15
+ if props.matchContents, let childUIView = firstChildUIView {
16
+ ApplySizeFromYogaNode(childUIView: childUIView) {
17
+ Children()
18
+ }
19
+ .onAppear {
20
+ ExpoUITouchHandlerHelper.createAndAttachTouchHandler(for: childUIView)
21
+ }
22
+ } else {
23
+ Children()
24
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
25
+ .modifier(ReportSizeToYogaNodeModifier(shadowNodeProxy: props.shadowNodeProxy))
26
+ .onAppear {
27
+ if let view = firstChildUIView {
28
+ ExpoUITouchHandlerHelper.createAndAttachTouchHandler(for: view)
29
+ }
30
+ }
31
+ }
32
+ }
33
+
34
+ private var firstChildUIView: UIView? {
35
+ props.children?.first?.uiView
36
+ }
37
+ }
38
+
39
+ // Sets SwiftUI view size from Yoga node size
40
+ // Listens to Yoga node size changes and updates the SwiftUI view size
41
+ private struct ApplySizeFromYogaNode<Content: SwiftUI.View>: SwiftUI.View {
42
+ @StateObject private var observer: Observer
43
+ let content: Content
44
+
45
+ init(childUIView: UIView, @ViewBuilder content: () -> Content) {
46
+ _observer = StateObject(wrappedValue: Observer(view: childUIView))
47
+ self.content = content()
9
48
  }
10
49
 
11
- public var matchContents: Bool = false
50
+ var body: some SwiftUI.View {
51
+ content
52
+ .frame(width: observer.size.width, height: observer.size.height)
53
+ }
54
+
55
+ @MainActor
56
+ fileprivate class Observer: ObservableObject {
57
+ @Published var size: CGSize
58
+ private var kvoToken: NSKeyValueObservation?
59
+
60
+ init(view: UIView) {
61
+ self.size = view.bounds.size
62
+ kvoToken = view.observe(\.bounds) { [weak self] view, _ in
63
+ MainActor.assumeIsolated {
64
+ self?.size = view.bounds.size
65
+ }
66
+ }
67
+ }
68
+
69
+ deinit {
70
+ kvoToken?.invalidate()
71
+ }
72
+ }
73
+ }
74
+
75
+ // Sets Yoga node size from SwiftUI view size
76
+ // Listens to SwiftUI view size changes and updates the Yoga node size
77
+ private struct ReportSizeToYogaNodeModifier: ViewModifier {
78
+ let shadowNodeProxy: ExpoSwiftUI.ShadowNodeProxy
79
+
80
+ private func handleSizeChange(_ size: CGSize) {
81
+ shadowNodeProxy.setViewSize?(size)
82
+ }
12
83
 
13
- public override func layoutSubviews() {
14
- super.layoutSubviews()
15
- if matchContents, let subview = self.subviews.first {
16
- self.setViewSize(subview.bounds.size)
84
+ func body(content: Content) -> some View {
85
+ if #available(iOS 16.0, tvOS 16.0, macOS 13.0, *) {
86
+ content.onGeometryChange(for: CGSize.self, of: { proxy in proxy.size }) { size in
87
+ handleSizeChange(size)
88
+ }
17
89
  } else {
18
- self.setViewSize(bounds.size)
90
+ content.overlay {
91
+ GeometryReader { geometry in
92
+ Color.clear
93
+ .hidden()
94
+ .onAppear {
95
+ handleSizeChange(geometry.size)
96
+ }
97
+ .onChange(of: geometry.size) { handleSizeChange($0) }
98
+ }
99
+ }
19
100
  }
20
101
  }
21
102
  }
@@ -95,21 +95,15 @@ internal struct SectionView: ExpoSwiftUI.View {
95
95
  }
96
96
  }
97
97
 
98
- private var contentChildren: SectionContent? {
99
- props.children?
100
- .compactMap({ $0.childView as? SectionContent })
101
- .first
98
+ private var contentChildren: SlotView? {
99
+ props.children?.slot("content")
102
100
  }
103
101
 
104
- private var headerView: SectionHeader? {
105
- props.children?
106
- .compactMap({ $0.childView as? SectionHeader })
107
- .first
102
+ private var headerView: SlotView? {
103
+ props.children?.slot("header")
108
104
  }
109
105
 
110
- private var footerView: SectionFooter? {
111
- props.children?
112
- .compactMap({ $0.childView as? SectionFooter })
113
- .first
106
+ private var footerView: SlotView? {
107
+ props.children?.slot("footer")
114
108
  }
115
109
  }
@@ -46,7 +46,6 @@ struct SecureFieldView: ExpoSwiftUI.View, ExpoSwiftUI.FocusableView {
46
46
  props.placeholder,
47
47
  text: $textManager.text
48
48
  )
49
- .modifier(UIBaseViewModifier(props: props))
50
49
  .fixedSize(horizontal: false, vertical: true)
51
50
  .focused($isFocused)
52
51
  .onSubmit({
@@ -97,7 +97,7 @@ struct ShareLinkView: ExpoSwiftUI.View {
97
97
 
98
98
  var body: some View {
99
99
  #if !os(tvOS)
100
- shareLink.modifier(UIBaseViewModifier(props: props))
100
+ shareLink
101
101
  .onDisappear {
102
102
  // cleanup if unmounted mid async request
103
103
  if #available(iOS 16.0, *) {
@@ -6,6 +6,7 @@ import ExpoModulesCore
6
6
  struct SliderView: ExpoSwiftUI.View {
7
7
  @ObservedObject var props: SliderProps
8
8
  @State var value: Float = 0.0
9
+ @State var isEditing: Bool = false
9
10
 
10
11
  init(props: SliderProps) {
11
12
  self.props = props
@@ -23,8 +24,8 @@ struct SliderView: ExpoSwiftUI.View {
23
24
  }
24
25
  }
25
26
  .onReceive(props.value.publisher, perform: { newValue in
26
- var sliderValue = newValue
27
- value = sliderValue
27
+ guard !isEditing else { return }
28
+ value = newValue
28
29
  })
29
30
  #else
30
31
  Text("Slider is not supported on tvOS")
@@ -34,14 +35,9 @@ struct SliderView: ExpoSwiftUI.View {
34
35
  #if !os(tvOS)
35
36
  @ViewBuilder
36
37
  private var sliderContent: some View {
37
- let label = props.children?.compactMap({ $0.childView as? SliderLabelView })
38
- .first(where: { $0.props.kind == .label })
39
- let minimumValueLabel = props.children?
40
- .compactMap({ $0.childView as? SliderLabelView })
41
- .first(where: { $0.props.kind == .minimum })
42
- let maximumValueLabel = props.children?
43
- .compactMap({ $0.childView as? SliderLabelView })
44
- .first(where: { $0.props.kind == .maximum })
38
+ let label = props.children?.slot("label")
39
+ let minimumValueLabel = props.children?.slot("minimum")
40
+ let maximumValueLabel = props.children?.slot("maximum")
45
41
 
46
42
  if let min = props.min, let max = props.max, let step = props.step {
47
43
  Slider(
@@ -52,6 +48,7 @@ struct SliderView: ExpoSwiftUI.View {
52
48
  minimumValueLabel: { minimumValueLabel },
53
49
  maximumValueLabel: { maximumValueLabel }
54
50
  ) { isEditing in
51
+ self.isEditing = isEditing
55
52
  props.onEditingChanged(["isEditing": isEditing])
56
53
  }
57
54
  } else if let min = props.min, let max = props.max {
@@ -62,6 +59,7 @@ struct SliderView: ExpoSwiftUI.View {
62
59
  minimumValueLabel: { minimumValueLabel },
63
60
  maximumValueLabel: { maximumValueLabel }
64
61
  ) { isEditing in
62
+ self.isEditing = isEditing
65
63
  props.onEditingChanged(["isEditing": isEditing])
66
64
  }
67
65
  } else if let step = props.step {
@@ -73,6 +71,7 @@ struct SliderView: ExpoSwiftUI.View {
73
71
  minimumValueLabel: { minimumValueLabel },
74
72
  maximumValueLabel: { maximumValueLabel }
75
73
  ) { isEditing in
74
+ self.isEditing = isEditing
76
75
  props.onEditingChanged(["isEditing": isEditing])
77
76
  }
78
77
  } else {
@@ -82,6 +81,7 @@ struct SliderView: ExpoSwiftUI.View {
82
81
  minimumValueLabel: { minimumValueLabel },
83
82
  maximumValueLabel: { maximumValueLabel }
84
83
  ) { isEditing in
84
+ self.isEditing = isEditing
85
85
  props.onEditingChanged(["isEditing": isEditing])
86
86
  }
87
87
  }
@@ -98,20 +98,3 @@ final class SliderProps: UIBaseViewProps {
98
98
  var onEditingChanged = EventDispatcher()
99
99
  }
100
100
 
101
- internal enum SliderLabelKind: String, Enumerable {
102
- case label
103
- case minimum
104
- case maximum
105
- }
106
-
107
- internal final class SliderLabelProps: ExpoSwiftUI.ViewProps {
108
- @Field var kind: SliderLabelKind = .minimum
109
- }
110
-
111
- internal struct SliderLabelView: ExpoSwiftUI.View {
112
- @ObservedObject var props: SliderLabelProps
113
-
114
- var body: some View {
115
- Children()
116
- }
117
- }
@@ -0,0 +1,38 @@
1
+ // Copyright 2025-present 650 Industries. All rights reserved.
2
+
3
+ import SwiftUI
4
+ import ExpoModulesCore
5
+
6
+ internal final class SlotViewProps: ExpoSwiftUI.ViewProps {
7
+ @Field var name: String = ""
8
+ }
9
+
10
+ internal struct SlotView: ExpoSwiftUI.View {
11
+ @ObservedObject var props: SlotViewProps
12
+
13
+ init(props: SlotViewProps) {
14
+ self.props = props
15
+ }
16
+
17
+ var body: some View {
18
+ Children()
19
+ }
20
+ }
21
+
22
+ extension [any ExpoSwiftUI.AnyChild] {
23
+ func slot(_ name: String) -> SlotView? {
24
+ compactMap { $0.childView as? SlotView }
25
+ .first { $0.props.name == name }
26
+ }
27
+
28
+ func withoutSlot(_ name: String) -> [any ExpoSwiftUI.AnyChild] {
29
+ filter {
30
+ guard let slot = $0.childView as? SlotView else { return true }
31
+ return slot.props.name != name
32
+ }
33
+ }
34
+
35
+ func withoutSlots() -> [any ExpoSwiftUI.AnyChild] {
36
+ filter { !($0.childView is SlotView) }
37
+ }
38
+ }
@@ -161,7 +161,6 @@ struct TextFieldView: ExpoSwiftUI.View, ExpoSwiftUI.FocusableView {
161
161
  )
162
162
  }
163
163
  return text.lineLimit((props.multiline && allowMultiLine()) ? props.numberOfLines : 1)
164
- .modifier(UIBaseViewModifier(props: props))
165
164
  .fixedSize(horizontal: false, vertical: true)
166
165
  .keyboardType(getKeyboardType(props.keyboardType))
167
166
  .autocorrectionDisabled(!props.autocorrection)
@@ -8,22 +8,24 @@ import SwiftUI
8
8
  */
9
9
  public struct UIBaseView<Props: UIBaseViewProps, Content: ExpoSwiftUI.View<Props>>: ExpoSwiftUI.View {
10
10
  @ObservedObject public var props: Props
11
+ let innerView: Content
11
12
 
12
13
  public init(props: Props) {
13
14
  self.props = props
15
+ self.innerView = Content(props: props)
14
16
  }
15
17
 
16
18
  public var body: some View {
17
- Content(props: props)
19
+ innerView
18
20
  .applyAccessibilityIdentifier(props.testID)
19
21
  .applyModifiers(props.modifiers, appContext: props.appContext, globalEventDispatcher: props.globalEventDispatcher)
20
22
  }
21
23
  }
22
24
 
23
25
  /**
24
- Base view modifier in expo-ui
25
- This is useful for View with AsyncFunctions that cannot use the `ExpoUIView` builder.
26
+ Deprecated. Use `applyModifiers` method directly instead.
26
27
  */
28
+ @available(*, deprecated, message: "Use applyModifiers method directly on the content view instead.")
27
29
  public struct UIBaseViewModifier<Props: UIBaseViewProps>: ViewModifier {
28
30
  @ObservedObject var props: Props
29
31
  var defaultFrameAlignment = Alignment.center
@@ -35,6 +37,21 @@ public struct UIBaseViewModifier<Props: UIBaseViewProps>: ViewModifier {
35
37
  }
36
38
  }
37
39
 
40
+ // MARK: - ViewWrapper
41
+
42
+ extension UIBaseView: ExpoSwiftUI.ViewWrapper {
43
+ public func getWrappedView() -> Any {
44
+ return innerView
45
+ }
46
+ }
47
+
48
+ // MARK: - FocusableView forwarding
49
+ extension UIBaseView: ExpoSwiftUI.FocusableView where Content: ExpoSwiftUI.FocusableView {
50
+ public func forceResignFirstResponder() {
51
+ innerView.forceResignFirstResponder()
52
+ }
53
+ }
54
+
38
55
  /**
39
56
  Common UI Builder in expo-ui.
40
57
  This is similar to expo-modules-core's View builder but further supports common base view props and modifiers
@@ -49,3 +66,17 @@ public func ExpoUIView<Content: ExpoSwiftUI.View>(
49
66
  ViewName(contentName)
50
67
  }
51
68
  }
69
+
70
+ /**
71
+ ExpoUIView overload that accepts a `@ViewDefinitionBuilder` closure for registering
72
+ AsyncFunctions and other view definition elements.
73
+ */
74
+ public func ExpoUIView<Content: ExpoSwiftUI.View>(
75
+ _ contentType: Content.Type,
76
+ @ExpoSwiftUI.ViewDefinitionBuilder<Content> _ elements: @escaping () -> [AnyViewDefinitionElement]
77
+ ) -> ExpoSwiftUI.ViewDefinition<Content.Props, UIBaseView<Content.Props, Content>> where Content.Props: UIBaseViewProps {
78
+ let wrappedType = UIBaseView<Content.Props, Content>.self
79
+ let contentName = String(describing: contentType)
80
+
81
+ return ExpoSwiftUI.ViewDefinition(wrappedType, name: contentName, elements: elements())
82
+ }
@@ -0,0 +1 @@
1
+ a34da0ffd5b373d346c39f45a5a61ec09f5c1b7b
@@ -0,0 +1 @@
1
+ 2b50088dab0279da8a113fe0396237a4525f8a9fb130d4b1cd15b5072f866a53
@@ -0,0 +1 @@
1
+ 588744d4be57b3e7ed22bcccd40222dcb365367cd3bb72fd0aeb4c0f1925229f986b58712f477a0eebdeb0e8d887b09e0aab21764dc372a5755e622118d88d7b
@@ -0,0 +1 @@
1
+ d9837c255bb0284a69d6b234195055a11d9bd98f
@@ -0,0 +1 @@
1
+ 9a82f1f77a7ee3f302982361eb41e2bb8b86cbd430061a07cce8c4511b40cbf4
@@ -0,0 +1 @@
1
+ 8a56aa5f1a198809e7bd3601605ec9e5ae7414b7834d6d6a44c024991f27de1cd744ed4b575b23b6b537e3e759c39309b220ca9fe57ec76c42b4130326c331fb
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "expo.modules.ui",
5
5
  "module": "expo.modules.ui",
6
- "version": "55.0.1",
6
+ "version": "55.0.2",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -24,13 +24,13 @@
24
24
  },
25
25
  "files": [
26
26
  {
27
- "name": "expo.modules.ui-55.0.1.aar",
28
- "url": "expo.modules.ui-55.0.1.aar",
29
- "size": 732681,
30
- "sha512": "35a4fa077be99bf9bebfd55d3398894d0150be4a5a60503d407a6a487290f5b2fdd0b0624986ef2781097d50a3c1fe973786fd79a738e94d1de0228b04ab3e01",
31
- "sha256": "981050003cd4b3d57f26a29a9e0466bdbdae41cc8df253b571858ba1e46a6ab9",
32
- "sha1": "6c884449165b70583d08844b02f31ab547df4438",
33
- "md5": "28406ef3849bb822054f845e1e731d11"
27
+ "name": "expo.modules.ui-55.0.2.aar",
28
+ "url": "expo.modules.ui-55.0.2.aar",
29
+ "size": 776412,
30
+ "sha512": "8a56aa5f1a198809e7bd3601605ec9e5ae7414b7834d6d6a44c024991f27de1cd744ed4b575b23b6b537e3e759c39309b220ca9fe57ec76c42b4130326c331fb",
31
+ "sha256": "9a82f1f77a7ee3f302982361eb41e2bb8b86cbd430061a07cce8c4511b40cbf4",
32
+ "sha1": "d9837c255bb0284a69d6b234195055a11d9bd98f",
33
+ "md5": "c2ddc40af222d8ef304b15d13a112399"
34
34
  }
35
35
  ]
36
36
  },
@@ -120,13 +120,13 @@
120
120
  ],
121
121
  "files": [
122
122
  {
123
- "name": "expo.modules.ui-55.0.1.aar",
124
- "url": "expo.modules.ui-55.0.1.aar",
125
- "size": 732681,
126
- "sha512": "35a4fa077be99bf9bebfd55d3398894d0150be4a5a60503d407a6a487290f5b2fdd0b0624986ef2781097d50a3c1fe973786fd79a738e94d1de0228b04ab3e01",
127
- "sha256": "981050003cd4b3d57f26a29a9e0466bdbdae41cc8df253b571858ba1e46a6ab9",
128
- "sha1": "6c884449165b70583d08844b02f31ab547df4438",
129
- "md5": "28406ef3849bb822054f845e1e731d11"
123
+ "name": "expo.modules.ui-55.0.2.aar",
124
+ "url": "expo.modules.ui-55.0.2.aar",
125
+ "size": 776412,
126
+ "sha512": "8a56aa5f1a198809e7bd3601605ec9e5ae7414b7834d6d6a44c024991f27de1cd744ed4b575b23b6b537e3e759c39309b220ca9fe57ec76c42b4130326c331fb",
127
+ "sha256": "9a82f1f77a7ee3f302982361eb41e2bb8b86cbd430061a07cce8c4511b40cbf4",
128
+ "sha1": "d9837c255bb0284a69d6b234195055a11d9bd98f",
129
+ "md5": "c2ddc40af222d8ef304b15d13a112399"
130
130
  }
131
131
  ]
132
132
  },
@@ -140,13 +140,13 @@
140
140
  },
141
141
  "files": [
142
142
  {
143
- "name": "expo.modules.ui-55.0.1-sources.jar",
144
- "url": "expo.modules.ui-55.0.1-sources.jar",
145
- "size": 51394,
146
- "sha512": "fe721d26e09241994a20838afa7aecfcd15a3c74bb104a3b42753cb73608ad6784f0d820db4b654b6fd65df1165574b8353040f8d0a2161c2e3413e18c2b9b79",
147
- "sha256": "addee5fe747747c7459fb227f67189cd0c0a064fe2a037ed67057c560e7fb335",
148
- "sha1": "6e19bff717c5770bfbfab0f7b94f6e98217dc504",
149
- "md5": "d9047cbc88b3f7cbf9728460e27dd43d"
143
+ "name": "expo.modules.ui-55.0.2-sources.jar",
144
+ "url": "expo.modules.ui-55.0.2-sources.jar",
145
+ "size": 56358,
146
+ "sha512": "588744d4be57b3e7ed22bcccd40222dcb365367cd3bb72fd0aeb4c0f1925229f986b58712f477a0eebdeb0e8d887b09e0aab21764dc372a5755e622118d88d7b",
147
+ "sha256": "2b50088dab0279da8a113fe0396237a4525f8a9fb130d4b1cd15b5072f866a53",
148
+ "sha1": "a34da0ffd5b373d346c39f45a5a61ec09f5c1b7b",
149
+ "md5": "88aeb5d46abccb005a1f657379a191dd"
150
150
  }
151
151
  ]
152
152
  }
@@ -0,0 +1 @@
1
+ 30dbf6a3d9ec32bd3d35dcaa054f871c6aef4572
@@ -0,0 +1 @@
1
+ 776b37606fc84b29d80f4fad1667670284ba5424ef5463d07ddf9349a91092aa
@@ -0,0 +1 @@
1
+ 4ea7791e17643fc75674cebb245364eb7da0375f5f07bcba12d71021fbd53524280e0e41ab6aada44304126083e1ae4bdb554b0b5cbc81f8141e32200f8aea51
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>expo.modules.ui</groupId>
11
11
  <artifactId>expo.modules.ui</artifactId>
12
- <version>55.0.1</version>
12
+ <version>55.0.2</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.ui</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ 785a21c06743ebd45e830929302eacfed1a02577
@@ -0,0 +1 @@
1
+ eb010d0e31664cc2341979943ef6419479f3fa3a34db9596c4662860ad70ba79