react-native-segmented-control / segmented-control

React Native SegmentedControl library
MIT License
559 stars 86 forks source link

iOS 13 SegmentedControl support #16

Closed Guap6512 closed 4 years ago

Guap6512 commented 5 years ago

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: image

tintColor property makes no effect on it's appearance anymore.

funkyyy commented 5 years ago

same prob with ios13 what to do now? any idea?

emirvajzovic commented 5 years ago

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.

VenomApps commented 5 years ago

What's the status on this! Nothing is working!

ferrannp commented 5 years ago

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.

cpojer commented 5 years ago

@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).

radko93 commented 5 years ago

@cpojer I don't see tintColor fixed on RN 0.61.2 on iOS 13.

cpojer commented 5 years ago

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];
  }
}
alexstoyanov commented 5 years ago

@cpojer Where did you put that? I tried in AppDelegate.m but:

Screenshot 2019-10-16 at 11 25 59
cpojer commented 5 years ago

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

ferrannp commented 4 years ago

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?

cpojer commented 4 years ago

@ferrannp We'll remove it from RN soon!

ferrannp commented 4 years ago

@cpojer thank you but we would probably need a new maintainer here :)

warrenlalata commented 4 years ago

ff

Naturalclar commented 4 years ago

@cpojer @ferrannp If it's not a problem, I'd like to help maintain this package. Is there anything I can do to help?