Closed Guap6512 closed 4 years ago
same prob with ios13 what to do now? any idea?
iOS 13 SDK added the selectedSegmentTintColor property. You should wait for an update. Note: this only changes segmented control appearance for iOS 13, devices using iOS 12 or earlier still require tintColor property to be set.
What's the status on this! Nothing is working!
It looks like this component needs a re-work with all the new properties that iOS 13 brings to SegmentedControl. As you said, you are right, tintColor
won't work anymore.
@ferrannp is it possible that these were fixed in the version on react native master since we haven't actually removed that component from RN yet (we were waiting for stable releases).
@cpojer I don't see tintColor
fixed on RN 0.61.2 on iOS 13.
Here is a fix by @sammy-SC:
- (void)setTintColor:(UIColor *)tintColor
{
[super setTintColor:tintColor];
if (@available(iOS 13.0, *)) {
[self setSelectedSegmentTintColor:tintColor];
[self setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}
forState:UIControlStateSelected];
[self setTitleTextAttributes:@{NSForegroundColorAttributeName: tintColor}
forState:UIControlStateNormal];
}
}
@cpojer Where did you put that? I tried in AppDelegate.m but:
It has to go into the module here as a PR: https://github.com/react-native-community/react-native-segmented-control/blob/master/ios/RCTSegmentedControl.m
There are more stuff we can do to UISegmentedControl right now with iOS 13 @cpojer. I think it would be good to update it here and remove it from core (now core is fixed, here is not). @harisbaig100 are you around?
@ferrannp We'll remove it from RN soon!
@cpojer thank you but we would probably need a new maintainer here :)
ff
@cpojer @ferrannp If it's not a problem, I'd like to help maintain this package. Is there anything I can do to help?
Library version: 1.0.2
iOS 13 introduced a new version of SegmentedControl with changes in API, and library does not support customizing it now. Every SegmentedControl made with it now looks like this:
tintColor property makes no effect on it's appearance anymore.