Having trouble to find out a solution for changing the color of text for the selected Date in iOS 13 dark mode.
I know how to change the color of the text of a UIPicker view using code
self.timePicker.setValue(UIColor.black, forKeyPath: "textColor")
OR using User Defined Runtime Attributes. But nothing is working for changing the selected date color for iOS 13 Dark mode. With background white color and black text color, my date picker-view looks like this:
So with changing the text color black, does not change the selected date text color. It changes all the other text color to black; but not the selected one. Selected one stays white, which is default for dark mode.
You can write an extension for UIDatePicker and then set the textColor of the datePicker text to UIColor.label, it will dynamically change according to the interface mode(light/dark mode).
After this, you can set the textColor value like:-
I found something that solves the problem in a way. If I mark 'hightlightsToday' color to false, then the selected text shows with the color you set your code.
But if I wanted to highlight my selected date text color with a different color; in that case not sure which key value I have to change. So I am going to leave the question open, incase anyone knows how to change the selected date text color for dark mode.
You can resolve this problem via Info.plist file. Add "UIUserInterfaceStyle" key and "Light" value in Info.plist file.
Reference: https://github.com/xgfe/react-native-datepicker/issues/365#issuecomment-532875809
You can set
self.window
insideAppDelegate.m
and override Interface style like soSwift 5.*