Skip to content

Commit ffc25e5

Browse files
committed
feat: apply labelStyle to component label views
- Update Picker to use applyStyles(labelStyle) instead of labelColor - Apply labelStyle to TextField, NumberField, Stepper, and Slider labels - Update LabeledContent implementations to use explicit label blocks
1 parent b59449c commit ffc25e5

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

ios/components/NumberField/NumberFieldView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ public struct NumberFieldView: View {
1515
inputField()
1616
} else {
1717
if #available(iOS 16.0, *) {
18-
LabeledContent(props.label) {
18+
LabeledContent {
1919
inputField()
20+
} label: {
21+
Text(props.label)
22+
.applyStyles(props.labelStyle)
2023
}
2124
} else {
2225
HStack {
2326
Text(props.label)
27+
.applyStyles(props.labelStyle)
2428
inputField()
2529
}
2630
}

ios/components/Picker/PickerView.swift

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,7 @@ public struct PickerView: View {
6161

6262
@ViewBuilder
6363
private func labelView() -> some View {
64-
if let color = resolvedLabelColor {
65-
Text(props.label)
66-
.foregroundColor(color)
67-
} else {
68-
Text(props.label)
69-
.foregroundColor(.primary)
70-
}
71-
}
72-
73-
private var resolvedLabelColor: Color? {
74-
guard let colorValue = props.labelColor else {
75-
return nil
76-
}
77-
return Color(value: colorValue)
64+
Text(props.label)
65+
.applyStyles(props.labelStyle)
7866
}
7967
}

ios/components/Slider/SliderView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ public struct SliderView<Content: View>: View {
1818
sliderContent()
1919
} else {
2020
if #available(iOS 16.0, *) {
21-
LabeledContent(props.label) {
21+
LabeledContent {
2222
sliderContent()
23+
} label: {
24+
Text(props.label)
25+
.applyStyles(props.labelStyle)
2326
}
2427
} else {
2528
HStack {
2629
Text(props.label)
30+
.applyStyles(props.labelStyle)
2731
sliderContent()
2832
}
2933
}

ios/components/Stepper/StepperView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@ public struct StepperView<Content: View>: View {
1717
stepperContent()
1818
} else {
1919
if #available(iOS 16.0, *) {
20-
LabeledContent(props.label) {
20+
LabeledContent {
2121
stepperContent()
22+
} label: {
23+
Text(props.label)
24+
.applyStyles(props.labelStyle)
2225
}
2326
} else {
2427
HStack {
2528
Text(props.label)
29+
.applyStyles(props.labelStyle)
2630
stepperContent()
2731
}
2832
}

ios/components/TextField/TextFieldView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ public struct TextFieldView: View {
1616
inputField()
1717
} else {
1818
if #available(iOS 16.0, *) {
19-
LabeledContent(props.label) {
19+
LabeledContent {
2020
inputField()
21+
} label: {
22+
Text(props.label)
23+
.applyStyles(props.labelStyle)
2124
}
2225
} else {
2326
HStack {
2427
Text(props.label)
28+
.applyStyles(props.labelStyle)
2529
inputField()
2630
}
2731
}

0 commit comments

Comments
 (0)