Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[segmented-control] Upgrade @react-native-community/segmented-control to 1.6.1 #8441

Merged
merged 2 commits into from May 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -38,6 +38,7 @@ Package-specific changes not released in any SDK will be added here just before
### 🎉 New features

- Initial release of **`expo-notifications`** 🥳
- Added `@react-native-community/segmented-control` in version `1.6.1`. ([#8038](https://github.com/expo/expo/pull/8038) by [@marchenk0va](https://github.com/marchenk0va) and [#8441](https://github.com/expo/expo/pull/8441) by [@tsapeta](https://github.com/tsapeta))
- **`expo-apple-authentication`**
- Add 'Sign up with Apple' option (available as of iOS 13.2). ([#7471](https://github.com/expo/expo/pull/7471) by [@IjzerenHein](https://github.com/IjzerenHein))
- **`expo-file-system`**
Expand Down
2 changes: 1 addition & 1 deletion apps/bare-expo/package.json
Expand Up @@ -79,7 +79,7 @@
},
"dependencies": {
"@babel/runtime": "^7.5.5",
"@react-native-community/segmented-control": "^1.4.0",
"@react-native-community/segmented-control": "1.6.1",
"@react-navigation/web": "2.0.0-alpha.0",
"expo": "~37.0.6",
"expo-image": "~1.0.0-alpha.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/native-component-list/package.json
Expand Up @@ -16,7 +16,7 @@
"@react-native-community/datetimepicker": "2.2.2",
"@react-native-community/masked-view": "0.1.6",
"@react-native-community/netinfo": "5.9.0",
"@react-native-community/segmented-control": "^1.4.0",
"@react-native-community/segmented-control": "1.6.1",
"@react-native-community/viewpager": "3.3.0",
"@react-navigation/web": "2.0.0-alpha.0",
"date-format": "^2.0.0",
Expand Down
22 changes: 21 additions & 1 deletion ios/Exponent.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -10,7 +10,7 @@
#import <React/RCTComponent.h>

@interface RNCSegmentedControl : UISegmentedControl

@property (nonatomic, copy) NSMutableDictionary *attributes;
@property (nonatomic, assign) NSInteger selectedIndex;
@property (nonatomic, copy) RCTBubblingEventBlock onChange;

Expand Down
Expand Up @@ -19,6 +19,7 @@ - (instancetype)initWithFrame:(CGRect)frame
_selectedIndex = self.selectedSegmentIndex;
[self addTarget:self action:@selector(didChange)
forControlEvents:UIControlEventValueChanged];
_attributes = [[NSMutableDictionary alloc] init];
}
return self;
}
Expand All @@ -38,6 +39,18 @@ - (void)setSelectedIndex:(NSInteger)selectedIndex
super.selectedSegmentIndex = selectedIndex;
}

- (void)setFontSize:(NSInteger)fontSize
{
UIFont *font = [UIFont systemFontOfSize: fontSize];
[_attributes setObject: font forKey:NSFontAttributeName];
[self setTitleTextAttributes:_attributes
forState:UIControlStateNormal];
UIFont *fontBold = [UIFont boldSystemFontOfSize: fontSize];
[_attributes setObject: fontBold forKey:NSFontAttributeName];
[self setTitleTextAttributes:_attributes
forState:UIControlStateSelected];
}

- (void)setBackgroundColor:(UIColor *)backgroundColor
{
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
Expand All @@ -53,8 +66,9 @@ - (void)setTextColor:(UIColor *)textColor
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
if (@available(iOS 13.0, *)) {
[self setTitleTextAttributes:@{NSForegroundColorAttributeName: textColor}
forState:UIControlStateNormal];
[_attributes setObject: textColor forKey:NSForegroundColorAttributeName];
[self setTitleTextAttributes:_attributes
forState:UIControlStateNormal];
}
#endif
}
Expand All @@ -64,7 +78,8 @@ - (void)setActiveTextColor:(UIColor *)textColor
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
if (@available(iOS 13.0, *)) {
[self setTitleTextAttributes:@{NSForegroundColorAttributeName: textColor}
[_attributes setObject: textColor forKey:NSForegroundColorAttributeName];
[self setTitleTextAttributes:_attributes
forState:UIControlStateSelected];
}
#endif
Expand All @@ -77,8 +92,9 @@ - (void)setTintColor:(UIColor *)tintColor
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
if (@available(iOS 13.0, *)) {
[self setSelectedSegmentTintColor:tintColor];
[self setTitleTextAttributes:@{NSForegroundColorAttributeName: tintColor}
forState:UIControlStateNormal];
[_attributes setObject: tintColor forKey:NSForegroundColorAttributeName];
[self setTitleTextAttributes:_attributes
forState:UIControlStateNormal];
}
#endif
}
Expand Down
Expand Up @@ -25,6 +25,7 @@ - (UIView *)view
RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor)
RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor)
RCT_EXPORT_VIEW_PROPERTY(textColor, UIColor)
RCT_EXPORT_VIEW_PROPERTY(fontSize, NSInteger)
RCT_EXPORT_VIEW_PROPERTY(activeTextColor, UIColor)
RCT_EXPORT_VIEW_PROPERTY(momentary, BOOL)
RCT_EXPORT_VIEW_PROPERTY(enabled, BOOL)
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/bundledNativeModules.json
Expand Up @@ -90,7 +90,7 @@
"@react-native-community/datetimepicker": "2.2.2",
"@react-native-community/masked-view": "0.1.6",
"@react-native-community/viewpager": "3.3.0",
"@react-native-community/segmented-control": "1.4.0",
"@react-native-community/segmented-control": "1.6.1",
"expo-error-recovery": "~1.1.0",
"expo-module-template": "~8.2.0",
"expo-image-loader": "~1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Expand Up @@ -2414,7 +2414,7 @@
resolved "https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-5.9.0.tgz#8bf2b96ce66ecaacab5a1f6f88b41526c9331481"
integrity sha512-rzchLeRkJRXw7ILO4OAMqVP33hEJ754FN2qf85+V1th9ozelXezh4DX90lmxk0PgJpZMwHXUNqS2ltsrzmahXg==

"@react-native-community/segmented-control@^1.4.0":
"@react-native-community/segmented-control@1.6.1":
version "1.6.1"
resolved "https://registry.yarnpkg.com/@react-native-community/segmented-control/-/segmented-control-1.6.1.tgz#47c5eb20664376e390c3412d9a7242c2df35cdb0"
integrity sha512-6TCrkDHgchKU2RA0r+V49Uwvv9mMhLKCwx7sf6Jkj0D4RYs+qmxYFjoM82bOcaH2kOVF+cvRvABRn0Ai0my5LA==
Expand Down