@expo/ui 58.0.22 → 58.0.24
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/CHANGELOG.md +28 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/ComposeViews.kt +53 -29
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +6 -4
- package/android/src/main/java/expo/modules/ui/HostView.kt +85 -15
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +40 -12
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +138 -2
- package/android/src/main/java/expo/modules/ui/SliderView.kt +5 -4
- package/android/src/main/java/expo/modules/ui/UniversalLayout.kt +610 -0
- package/android/src/main/java/expo/modules/ui/VerticalSliderView.kt +5 -4
- package/android/src/main/java/expo/modules/ui/state/ObservableState.kt +2 -0
- package/android/src/main/java/expo/modules/ui/state/WorkletCallback.kt +2 -0
- package/build/community/bottom-sheet/BottomSheet.android.js +2 -0
- package/build/community/bottom-sheet/BottomSheet.android.js.map +1 -1
- package/build/community/menu/MenuView.ios.js +2 -1
- package/build/community/menu/MenuView.ios.js.map +1 -1
- package/build/jetpack-compose/Column/index.d.ts +5 -0
- package/build/jetpack-compose/Column/index.js.map +1 -1
- package/build/jetpack-compose/Row/index.d.ts +5 -0
- package/build/jetpack-compose/Row/index.js.map +1 -1
- package/build/jetpack-compose/Text/index.js +5 -4
- package/build/jetpack-compose/Text/index.js.map +1 -1
- package/build/recycling/useRecycledRows.d.ts +2 -0
- package/build/recycling/useRecycledRows.js +1 -0
- package/build/recycling/useRecycledRows.js.map +1 -1
- package/build/swift-ui/ContentUnavailableView/index.d.ts +5 -0
- package/build/swift-ui/ContentUnavailableView/index.js +7 -2
- package/build/swift-ui/ContentUnavailableView/index.js.map +1 -1
- package/build/swift-ui/HStack/index.d.ts +6 -0
- package/build/swift-ui/HStack/index.js.map +1 -1
- package/build/swift-ui/RNHostView.d.ts +7 -1
- package/build/swift-ui/RNHostView.js +2 -1
- package/build/swift-ui/RNHostView.js.map +1 -1
- package/build/swift-ui/Text/index.js +2 -1
- package/build/swift-ui/Text/index.js.map +1 -1
- package/build/swift-ui/VStack/index.d.ts +6 -0
- package/build/swift-ui/VStack/index.js.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +18 -0
- package/build/swift-ui/modifiers/index.js +9 -0
- package/build/swift-ui/modifiers/index.js.map +1 -1
- package/build/universal/BottomSheet/index.android.js +5 -5
- package/build/universal/BottomSheet/index.android.js.map +1 -1
- package/build/universal/Button/index.android.js +3 -1
- package/build/universal/Button/index.android.js.map +1 -1
- package/build/universal/Button/index.ios.js +3 -1
- package/build/universal/Button/index.ios.js.map +1 -1
- package/build/universal/Collapsible/index.ios.js +1 -0
- package/build/universal/Collapsible/index.ios.js.map +1 -1
- package/build/universal/Column/index.android.js +4 -1
- package/build/universal/Column/index.android.js.map +1 -1
- package/build/universal/Column/index.ios.js +2 -0
- package/build/universal/Column/index.ios.js.map +1 -1
- package/build/universal/Column/index.js +13 -4
- package/build/universal/Column/index.js.map +1 -1
- package/build/universal/FieldGroup/FieldGroup.android.js +3 -1
- package/build/universal/FieldGroup/FieldGroup.android.js.map +1 -1
- package/build/universal/FieldGroup/FieldGroup.ios.js +3 -1
- package/build/universal/FieldGroup/FieldGroup.ios.js.map +1 -1
- package/build/universal/FieldGroup/FieldSection.android.js +13 -4
- package/build/universal/FieldGroup/FieldSection.android.js.map +1 -1
- package/build/universal/FieldGroup/FieldSection.ios.js +3 -1
- package/build/universal/FieldGroup/FieldSection.ios.js.map +1 -1
- package/build/universal/Icon/index.android.js +3 -1
- package/build/universal/Icon/index.android.js.map +1 -1
- package/build/universal/Icon/index.ios.js +3 -1
- package/build/universal/Icon/index.ios.js.map +1 -1
- package/build/universal/List/ListForEach.android.d.ts +7 -0
- package/build/universal/List/ListForEach.android.js +6 -0
- package/build/universal/List/ListForEach.android.js.map +1 -0
- package/build/universal/List/ListForEach.d.ts +5 -0
- package/build/universal/List/ListForEach.ios.d.ts +5 -0
- package/build/universal/List/ListForEach.ios.js +11 -0
- package/build/universal/List/ListForEach.ios.js.map +1 -0
- package/build/universal/List/ListForEach.js +263 -0
- package/build/universal/List/ListForEach.js.map +1 -0
- package/build/universal/List/ListScrollContext.d.ts +5 -0
- package/build/universal/List/ListScrollContext.js +6 -0
- package/build/universal/List/ListScrollContext.js.map +1 -0
- package/build/universal/List/index.android.d.ts +5 -0
- package/build/universal/List/index.android.js +3 -0
- package/build/universal/List/index.android.js.map +1 -1
- package/build/universal/List/index.d.ts +5 -0
- package/build/universal/List/index.ios.d.ts +5 -0
- package/build/universal/List/index.ios.js +3 -0
- package/build/universal/List/index.ios.js.map +1 -1
- package/build/universal/List/index.js +12 -1
- package/build/universal/List/index.js.map +1 -1
- package/build/universal/List/types.d.ts +42 -1
- package/build/universal/List/types.js +1 -3
- package/build/universal/List/types.js.map +1 -1
- package/build/universal/RNHostView/index.android.js +3 -1
- package/build/universal/RNHostView/index.android.js.map +1 -1
- package/build/universal/Row/index.android.js +4 -1
- package/build/universal/Row/index.android.js.map +1 -1
- package/build/universal/Row/index.ios.js +2 -0
- package/build/universal/Row/index.ios.js.map +1 -1
- package/build/universal/Row/index.js +13 -7
- package/build/universal/Row/index.js.map +1 -1
- package/build/universal/ScrollView/index.android.js +8 -1
- package/build/universal/ScrollView/index.android.js.map +1 -1
- package/build/universal/ScrollView/index.ios.js +3 -1
- package/build/universal/ScrollView/index.ios.js.map +1 -1
- package/build/universal/Spacer/index.android.js +3 -1
- package/build/universal/Spacer/index.android.js.map +1 -1
- package/build/universal/Spacer/index.ios.js +3 -1
- package/build/universal/Spacer/index.ios.js.map +1 -1
- package/build/universal/Text/index.android.js +3 -1
- package/build/universal/Text/index.android.js.map +1 -1
- package/build/universal/Text/index.ios.js +3 -1
- package/build/universal/Text/index.ios.js.map +1 -1
- package/build/universal/TextInput/index.android.js +22 -7
- package/build/universal/TextInput/index.android.js.map +1 -1
- package/build/universal/TextInput/index.ios.js +1 -0
- package/build/universal/TextInput/index.ios.js.map +1 -1
- package/build/universal/index.d.ts +1 -1
- package/build/universal/modifierUtils.d.ts +34 -1
- package/build/universal/modifierUtils.js +98 -2
- package/build/universal/modifierUtils.js.map +1 -1
- package/build/universal/stackAxis.d.ts +9 -0
- package/build/universal/stackAxis.js +11 -0
- package/build/universal/stackAxis.js.map +1 -0
- package/build/universal/transformStyle.android.d.ts +6 -2
- package/build/universal/transformStyle.android.js +18 -11
- package/build/universal/transformStyle.android.js.map +1 -1
- package/build/universal/transformStyle.ios.d.ts +5 -1
- package/build/universal/transformStyle.ios.js +29 -11
- package/build/universal/transformStyle.ios.js.map +1 -1
- package/build/universal/types.d.ts +26 -1
- package/build/universal/types.js.map +1 -1
- package/build/utils/flattenFragments.d.ts +7 -0
- package/build/utils/flattenFragments.js +17 -0
- package/build/utils/flattenFragments.js.map +1 -0
- package/ios/ContentUnavailableView.swift +9 -1
- package/ios/GroupView.swift +3 -0
- package/ios/HStackView.swift +26 -2
- package/ios/HostView.swift +21 -12
- package/ios/Modifiers/FontModifier.swift +27 -0
- package/ios/Modifiers/SectionIndexLabelModifier.swift +21 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +26 -0
- package/ios/RNHostView.swift +4 -0
- package/ios/ScrollViewComponent.swift +20 -0
- package/ios/UIBaseView.swift +4 -1
- package/ios/UniversalLayout.swift +691 -0
- package/ios/VStackView.swift +26 -2
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.22/expo.modules.ui-58.0.22-sources.jar → 58.0.24/expo.modules.ui-58.0.24-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.22/expo.modules.ui-58.0.22.module → 58.0.24/expo.modules.ui-58.0.24.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.22/expo.modules.ui-58.0.22.pom → 58.0.24/expo.modules.ui-58.0.24.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.pom.sha512 +1 -0
- package/package.json +1 -1
- package/src/community/bottom-sheet/BottomSheet.android.tsx +2 -1
- package/src/community/menu/MenuView.ios.tsx +3 -2
- package/src/jetpack-compose/Column/index.tsx +5 -0
- package/src/jetpack-compose/Row/index.tsx +5 -0
- package/src/jetpack-compose/Text/index.tsx +5 -4
- package/src/recycling/useRecycledRows.tsx +3 -0
- package/src/swift-ui/ContentUnavailableView/index.tsx +19 -4
- package/src/swift-ui/HStack/index.tsx +6 -0
- package/src/swift-ui/RNHostView.tsx +8 -1
- package/src/swift-ui/Text/index.tsx +2 -1
- package/src/swift-ui/VStack/index.tsx +6 -0
- package/src/swift-ui/modifiers/index.ts +19 -0
- package/src/universal/BottomSheet/index.android.tsx +3 -1
- package/src/universal/Button/index.android.tsx +3 -1
- package/src/universal/Button/index.ios.tsx +2 -1
- package/src/universal/Collapsible/index.ios.tsx +4 -1
- package/src/universal/Column/index.android.tsx +3 -1
- package/src/universal/Column/index.ios.tsx +2 -1
- package/src/universal/Column/index.tsx +9 -4
- package/src/universal/FieldGroup/FieldGroup.android.tsx +8 -1
- package/src/universal/FieldGroup/FieldGroup.ios.tsx +2 -1
- package/src/universal/FieldGroup/FieldSection.android.tsx +17 -4
- package/src/universal/FieldGroup/FieldSection.ios.tsx +2 -1
- package/src/universal/Icon/index.android.tsx +2 -1
- package/src/universal/Icon/index.ios.tsx +2 -1
- package/src/universal/List/ListForEach.android.tsx +6 -0
- package/src/universal/List/ListForEach.ios.tsx +9 -0
- package/src/universal/List/ListForEach.tsx +246 -0
- package/src/universal/List/ListScrollContext.ts +6 -0
- package/src/universal/List/index.android.tsx +5 -0
- package/src/universal/List/index.ios.tsx +5 -0
- package/src/universal/List/index.tsx +11 -2
- package/src/universal/List/types.ts +45 -1
- package/src/universal/RNHostView/index.android.tsx +2 -1
- package/src/universal/Row/index.android.tsx +3 -1
- package/src/universal/Row/index.ios.tsx +2 -1
- package/src/universal/Row/index.tsx +9 -10
- package/src/universal/ScrollView/index.android.tsx +15 -3
- package/src/universal/ScrollView/index.ios.tsx +2 -1
- package/src/universal/Spacer/index.android.tsx +6 -4
- package/src/universal/Spacer/index.ios.tsx +2 -1
- package/src/universal/Text/index.android.tsx +2 -1
- package/src/universal/Text/index.ios.tsx +2 -1
- package/src/universal/TextInput/index.android.tsx +26 -5
- package/src/universal/TextInput/index.ios.tsx +1 -1
- package/src/universal/index.ts +6 -1
- package/src/universal/modifierUtils.ts +159 -2
- package/src/universal/stackAxis.ts +17 -0
- package/src/universal/transformStyle.android.ts +30 -12
- package/src/universal/transformStyle.ios.ts +41 -13
- package/src/universal/types.ts +27 -3
- package/src/utils/flattenFragments.ts +22 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.pom.sha512 +0 -1
package/ios/HostView.swift
CHANGED
|
@@ -91,6 +91,7 @@ struct HostView: ExpoSwiftUI.View, ExpoSwiftUI.WithHostingView {
|
|
|
91
91
|
Children()
|
|
92
92
|
}
|
|
93
93
|
.environment(\.expoHostingView, props.hostingViewReference)
|
|
94
|
+
.environment(\.universalPercentageParent, true)
|
|
94
95
|
.modifier(HostViewContentMarginsMitigation(layoutDirection: layoutDirection, hostingView: props.hostingView))
|
|
95
96
|
.fixedSize(horizontal: props.matchContentsHorizontal, vertical: props.matchContentsVertical)
|
|
96
97
|
.modifier(LayoutDirectionModifier(layoutDirection: layoutDirection))
|
|
@@ -115,6 +116,7 @@ struct HostView: ExpoSwiftUI.View, ExpoSwiftUI.WithHostingView {
|
|
|
115
116
|
Children()
|
|
116
117
|
}
|
|
117
118
|
.environment(\.expoHostingView, props.hostingViewReference)
|
|
119
|
+
.environment(\.universalPercentageParent, true)
|
|
118
120
|
.fixedSize(horizontal: props.matchContentsHorizontal, vertical: props.matchContentsVertical)
|
|
119
121
|
.modifier(LayoutDirectionModifier(layoutDirection: layoutDirection))
|
|
120
122
|
.modifier(ColorSchemeModifier(colorScheme: props.colorScheme?.toColorScheme()))
|
|
@@ -166,16 +168,11 @@ private struct ViewportSizeMeasurementLayout: Layout {
|
|
|
166
168
|
weak var hostingView: UIView?
|
|
167
169
|
|
|
168
170
|
func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize {
|
|
169
|
-
let
|
|
170
|
-
let proposalWidth = proposal.width ?? 0
|
|
171
|
-
let proposalHeight = proposal.height ?? 0
|
|
172
|
-
let availableWidth = proposalWidth > 0 ? proposalWidth : maxSize.width
|
|
173
|
-
let availableHeight = proposalHeight > 0 ? proposalHeight : maxSize.height
|
|
174
|
-
|
|
171
|
+
let offered = measurementProposal(for: proposal)
|
|
175
172
|
var resultWidth: CGFloat = 0
|
|
176
173
|
var resultHeight: CGFloat = 0
|
|
177
174
|
for view in subviews {
|
|
178
|
-
let size = view.dimensions(in:
|
|
175
|
+
let size = view.dimensions(in: offered)
|
|
179
176
|
resultWidth = max(resultWidth, size.width)
|
|
180
177
|
resultHeight = max(resultHeight, size.height)
|
|
181
178
|
}
|
|
@@ -183,22 +180,34 @@ private struct ViewportSizeMeasurementLayout: Layout {
|
|
|
183
180
|
}
|
|
184
181
|
|
|
185
182
|
func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) {
|
|
183
|
+
// A child percentage applies to this proposal.
|
|
184
|
+
// Offering `bounds` would use the measured result and apply the fraction again.
|
|
185
|
+
let offered = measurementProposal(for: proposal)
|
|
186
186
|
let isRTL = layoutDirection == .rightToLeft
|
|
187
187
|
for subview in subviews {
|
|
188
188
|
let origin: CGPoint
|
|
189
189
|
if isRTL {
|
|
190
|
-
let size = subview.dimensions(in:
|
|
190
|
+
let size = subview.dimensions(in: offered)
|
|
191
191
|
origin = CGPoint(x: bounds.maxX - size.width, y: bounds.minY)
|
|
192
192
|
} else {
|
|
193
193
|
origin = bounds.origin
|
|
194
194
|
}
|
|
195
|
-
subview.place(
|
|
196
|
-
at: origin,
|
|
197
|
-
proposal: ProposedViewSize(bounds.size)
|
|
198
|
-
)
|
|
195
|
+
subview.place(at: origin, proposal: offered)
|
|
199
196
|
}
|
|
200
197
|
}
|
|
201
198
|
|
|
199
|
+
/// A zero or nil axis uses the safe area.
|
|
200
|
+
/// Placement offers this same size, so a percentage is applied once.
|
|
201
|
+
private func measurementProposal(for proposal: ProposedViewSize) -> ProposedViewSize {
|
|
202
|
+
let maxSize = safeAreaSize()
|
|
203
|
+
let proposalWidth = proposal.width ?? 0
|
|
204
|
+
let proposalHeight = proposal.height ?? 0
|
|
205
|
+
return ProposedViewSize(
|
|
206
|
+
width: proposalWidth > 0 ? proposalWidth : maxSize.width,
|
|
207
|
+
height: proposalHeight > 0 ? proposalHeight : maxSize.height
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
|
|
202
211
|
private func safeAreaSize() -> CGSize {
|
|
203
212
|
#if os(macOS)
|
|
204
213
|
// `SceneGeometry` is built on `UIWindowScene`, which has no macOS counterpart. The closest
|
|
@@ -29,6 +29,20 @@ internal enum FontWeight: String, Enumerable {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
internal enum FontLeading: String, Enumerable {
|
|
33
|
+
case standard
|
|
34
|
+
case tight
|
|
35
|
+
case loose
|
|
36
|
+
|
|
37
|
+
func toSwiftUI() -> Font.Leading {
|
|
38
|
+
switch self {
|
|
39
|
+
case .standard: .standard
|
|
40
|
+
case .tight: .tight
|
|
41
|
+
case .loose: .loose
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
32
46
|
internal enum FontDesign: String, Enumerable {
|
|
33
47
|
case `default`
|
|
34
48
|
case rounded
|
|
@@ -81,6 +95,8 @@ internal struct FontModifier: ViewModifier, Record {
|
|
|
81
95
|
@Field var weight: FontWeight?
|
|
82
96
|
@Field var design: FontDesign?
|
|
83
97
|
@Field var textStyle: FontTextStyle?
|
|
98
|
+
@Field var smallCaps: Bool = false
|
|
99
|
+
@Field var leading: FontLeading?
|
|
84
100
|
|
|
85
101
|
func body(content: Content) -> some View {
|
|
86
102
|
content.font(resolveFont())
|
|
@@ -90,6 +106,17 @@ internal struct FontModifier: ViewModifier, Record {
|
|
|
90
106
|
// same `Font` as the view path, instead of a fixed-size `Font.custom` that
|
|
91
107
|
// drops `relativeTo` (Dynamic Type) and `weight`.
|
|
92
108
|
func resolveFont() -> Font {
|
|
109
|
+
var font = resolveBaseFont()
|
|
110
|
+
if smallCaps {
|
|
111
|
+
font = font.smallCaps()
|
|
112
|
+
}
|
|
113
|
+
if let leading {
|
|
114
|
+
font = font.leading(leading.toSwiftUI())
|
|
115
|
+
}
|
|
116
|
+
return font
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private func resolveBaseFont() -> Font {
|
|
93
120
|
if let family = family {
|
|
94
121
|
let baseSize = size ?? 17
|
|
95
122
|
var font: Font = if let textStyle = textStyle {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright 2026-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
import ExpoModulesCore
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
internal struct SectionIndexLabelModifier: ViewModifier, Record {
|
|
7
|
+
@Field var label: String?
|
|
8
|
+
|
|
9
|
+
@ViewBuilder
|
|
10
|
+
func body(content: Content) -> some View {
|
|
11
|
+
if #available(iOS 26.0, macOS 26.0, tvOS 26.0, *) {
|
|
12
|
+
#if compiler(>=6.2) // Xcode 26
|
|
13
|
+
content.sectionIndexLabel(label)
|
|
14
|
+
#else
|
|
15
|
+
content
|
|
16
|
+
#endif
|
|
17
|
+
} else {
|
|
18
|
+
content
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1187,6 +1187,18 @@ internal enum TextLinePattern: String, Enumerable {
|
|
|
1187
1187
|
case dashDotDot
|
|
1188
1188
|
}
|
|
1189
1189
|
|
|
1190
|
+
internal extension TextLinePattern {
|
|
1191
|
+
func toSwiftUI() -> Text.LineStyle.Pattern {
|
|
1192
|
+
switch self {
|
|
1193
|
+
case .solid: return .solid
|
|
1194
|
+
case .dash: return .dash
|
|
1195
|
+
case .dot: return .dot
|
|
1196
|
+
case .dashDot: return .dashDot
|
|
1197
|
+
case .dashDotDot: return .dashDotDot
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1190
1202
|
internal struct TextUnderLine: ViewModifier, Record {
|
|
1191
1203
|
@Field var isActive: Bool = false
|
|
1192
1204
|
@Field var pattern: TextLinePattern = .solid
|
|
@@ -1635,6 +1647,12 @@ public class ViewModifierRegistry {
|
|
|
1635
1647
|
return text.foregroundColor(color)
|
|
1636
1648
|
}
|
|
1637
1649
|
return text
|
|
1650
|
+
case "underline":
|
|
1651
|
+
guard let modifier = try? TextUnderLine(from: params, appContext: appContext) else { return text }
|
|
1652
|
+
return text.underline(modifier.isActive, pattern: modifier.pattern.toSwiftUI(), color: modifier.color)
|
|
1653
|
+
case "strikethrough":
|
|
1654
|
+
guard let modifier = try? TextStrikeThrough(from: params, appContext: appContext) else { return text }
|
|
1655
|
+
return text.strikethrough(modifier.isActive, pattern: modifier.pattern.toSwiftUI(), color: modifier.color)
|
|
1638
1656
|
default:
|
|
1639
1657
|
#if DEBUG
|
|
1640
1658
|
return Text(" ['\(type)' not supported for nested Text]").foregroundColor(.red)
|
|
@@ -1921,6 +1939,10 @@ extension ViewModifierRegistry {
|
|
|
1921
1939
|
return try FrameModifier(from: params, appContext: appContext)
|
|
1922
1940
|
}
|
|
1923
1941
|
|
|
1942
|
+
register("universalLayout") { params, appContext, _ in
|
|
1943
|
+
return try UniversalLayoutModifier(from: params, appContext: appContext)
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1924
1946
|
register("padding") { params, appContext, _ in
|
|
1925
1947
|
return try PaddingModifier(from: params, appContext: appContext)
|
|
1926
1948
|
}
|
|
@@ -2500,6 +2522,10 @@ extension ViewModifierRegistry {
|
|
|
2500
2522
|
return try ListStyleModifier(from: params, appContext: appContext)
|
|
2501
2523
|
}
|
|
2502
2524
|
|
|
2525
|
+
register("sectionIndexLabel") { params, appContext, _ in
|
|
2526
|
+
return try SectionIndexLabelModifier(from: params, appContext: appContext)
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2503
2529
|
register("moveDisabled") { params, appContext, _ in
|
|
2504
2530
|
return try MoveDisabledModifier(from: params, appContext: appContext)
|
|
2505
2531
|
}
|
package/ios/RNHostView.swift
CHANGED
|
@@ -10,6 +10,10 @@ internal final class RNHostViewProps: ExpoSwiftUI.ViewProps {
|
|
|
10
10
|
Adds LeafNode and MeasurableYogaNode trait in Shadow node
|
|
11
11
|
*/
|
|
12
12
|
@Field var expoInternalSizeFromChildren: Bool = false
|
|
13
|
+
/**
|
|
14
|
+
Read by `ExpoViewShadowNode` in C++ to measure the children within the space Yoga gives the `Host`.
|
|
15
|
+
*/
|
|
16
|
+
@Field var expoInternalBoundedByHost: Bool = false
|
|
13
17
|
/**
|
|
14
18
|
Whether this view owns its subtree's touches and is the origin its content is measured from. Set
|
|
15
19
|
by the JavaScript side for content presented in its own view controller — see `RNHostView.tsx`,
|
|
@@ -10,6 +10,8 @@ public final class ScrollViewComponentProps: UIBaseViewProps {
|
|
|
10
10
|
|
|
11
11
|
public struct ScrollViewComponent: ExpoSwiftUI.View {
|
|
12
12
|
@ObservedObject public var props: ScrollViewComponentProps
|
|
13
|
+
// A fraction on this view is a real size only when the parent opted in.
|
|
14
|
+
@Environment(\.resolvesOwnPercentage) private var resolvesOwnPercentage
|
|
13
15
|
|
|
14
16
|
public init(props: ScrollViewComponentProps) {
|
|
15
17
|
self.props = props
|
|
@@ -19,5 +21,23 @@ public struct ScrollViewComponent: ExpoSwiftUI.View {
|
|
|
19
21
|
ScrollView(props.axes.toAxis(), showsIndicators: props.showsIndicators) {
|
|
20
22
|
Children()
|
|
21
23
|
}
|
|
24
|
+
// The cross axis resolves a child percentage against the viewport.
|
|
25
|
+
// The scroll axis stays unbounded, so a percentage on that axis does not.
|
|
26
|
+
.environment(\.universalPercentageParent, resolvesChildPercentages)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/// A vertical scroll view fills the width it is offered.
|
|
30
|
+
/// A horizontal scroll view takes its height from its content unless a size sets it.
|
|
31
|
+
/// That content height is not a percentage base.
|
|
32
|
+
private var resolvesChildPercentages: Bool {
|
|
33
|
+
switch props.axes {
|
|
34
|
+
case .vertical:
|
|
35
|
+
return true
|
|
36
|
+
case .horizontal:
|
|
37
|
+
let dimensions = universalLayoutDimensions(from: props.modifiers)
|
|
38
|
+
return dimensions.heightPoints != nil || (dimensions.heightFraction != nil && resolvesOwnPercentage)
|
|
39
|
+
case .both:
|
|
40
|
+
return false
|
|
41
|
+
}
|
|
22
42
|
}
|
|
23
43
|
}
|
package/ios/UIBaseView.swift
CHANGED
|
@@ -16,9 +16,12 @@ public struct UIBaseView<Props: UIBaseViewProps, Content: ExpoSwiftUI.View<Props
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
public var body: some View {
|
|
19
|
-
innerView
|
|
19
|
+
UniversalPercentageParentBoundary(content: innerView)
|
|
20
20
|
.applyAccessibilityIdentifier(props.testID)
|
|
21
21
|
.applyModifiers(props.modifiers, appContext: props.appContext, globalEventDispatcher: props.globalEventDispatcher)
|
|
22
|
+
// A user modifier such as `onGeometryChange` hides the layout value a universal stack reads.
|
|
23
|
+
// Set it again outside every modifier.
|
|
24
|
+
.layoutValue(key: UniversalLayoutDimensionsKey.self, value: universalLayoutDimensions(from: props.modifiers))
|
|
22
25
|
.publishZeroContentOrigin(props.shadowNodeProxy)
|
|
23
26
|
}
|
|
24
27
|
}
|