【发布时间】:2020-02-12 05:00:30
【问题描述】:
新的 iOS 13 更新引入了一个可选的系统范围。 这导致例如状态栏有浅色文本,在白色背景上可能会变得不可读。它还破坏了 iOS 日期时间选择器(请参阅 DatePickerIOS 或react-native-modal-datetime-picker)
【问题讨论】:
标签: react-native ios13 ios-darkmode
新的 iOS 13 更新引入了一个可选的系统范围。 这导致例如状态栏有浅色文本,在白色背景上可能会变得不可读。它还破坏了 iOS 日期时间选择器(请参阅 DatePickerIOS 或react-native-modal-datetime-picker)
【问题讨论】:
标签: react-native ios13 ios-darkmode
解决办法是
<key>UIUserInterfaceStyle</key>
<string>Light</string>
或
AppDelegate.m: if (@available(iOS 13.0, *)) {
rootView.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
}
【讨论】:
在您的 app.json 文件中添加:
{
"expo": {
...
"ios": {
"infoPlist": {
"UIUserInterfaceStyle": "Light"
}
},
}
【讨论】:
这个解决方案似乎效果最好。将此添加到您的AppDelagate.m
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
//add this here vv
if (@available(iOS 13, *)) {
self.window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
}
//add this here ^^
return YES;
【讨论】:
将此添加到您的 Info.plist 中
<key>UIUserInterfaceStyle</key>
<string>Light</string>
这是你的 AppDelegate.m
rootView.backgroundColor = [UIColor whiteColor];
【讨论】: