Skip to content

Commit 893ad2b

Browse files
authored
1.6.1 (#84)
1 parent 638269c commit 893ad2b

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

example/App.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,20 @@ export default class App extends React.Component<{}, $FlowFixMeState> {
7878
<Text style={styles.text}>
7979
Segmented controls can have defined fontSize
8080
</Text>
81+
<View style={styles.segmentContainer}>
82+
<SegmentedControl
83+
values={['One', 'Two']}
84+
style={{height: 80}}
85+
fontSize={32}
86+
/>
87+
</View>
8188
<SegmentedControl
8289
values={['One', 'Two']}
8390
style={{height: 80}}
8491
fontSize={32}
92+
textColor="blue"
93+
tintColor="green"
94+
activeTextColor="red"
8595
/>
8696
</View>
8797
<View>

ios/RNCSegmentedControl.m

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ - (void)setSelectedIndex:(NSInteger)selectedIndex
4141

4242
- (void)setFontSize:(NSInteger)fontSize
4343
{
44-
UIFont *font = [UIFont boldSystemFontOfSize: fontSize];
44+
UIFont *font = [UIFont systemFontOfSize: fontSize];
4545
[_attributes setObject: font forKey:NSFontAttributeName];
4646
[self setTitleTextAttributes:_attributes
4747
forState:UIControlStateNormal];
48+
UIFont *fontBold = [UIFont boldSystemFontOfSize: fontSize];
49+
[_attributes setObject: fontBold forKey:NSFontAttributeName];
50+
[self setTitleTextAttributes:_attributes
51+
forState:UIControlStateSelected];
4852
}
4953

5054
- (void)setBackgroundColor:(UIColor *)backgroundColor
@@ -74,7 +78,8 @@ - (void)setActiveTextColor:(UIColor *)textColor
7478
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
7579
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
7680
if (@available(iOS 13.0, *)) {
77-
[self setTitleTextAttributes:@{NSForegroundColorAttributeName: textColor}
81+
[_attributes setObject: textColor forKey:NSForegroundColorAttributeName];
82+
[self setTitleTextAttributes:_attributes
7883
forState:UIControlStateSelected];
7984
}
8085
#endif
@@ -87,8 +92,9 @@ - (void)setTintColor:(UIColor *)tintColor
8792
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
8893
if (@available(iOS 13.0, *)) {
8994
[self setSelectedSegmentTintColor:tintColor];
90-
[self setTitleTextAttributes:@{NSForegroundColorAttributeName: tintColor}
91-
forState:UIControlStateNormal];
95+
[_attributes setObject: tintColor forKey:NSForegroundColorAttributeName];
96+
[self setTitleTextAttributes:_attributes
97+
forState:UIControlStateNormal];
9298
}
9399
#endif
94100
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-native-community/segmented-control",
3-
"version": "1.6.0",
3+
"version": "1.6.1",
44
"description": "React Native SegmentedControlIOS library",
55
"main": "js/index.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)