如何在React Native中强制禁用iOS暗模式


Answers:


38

解决方案是

  1. 将此添加到您的Info.plist文件中:
    <key>UIUserInterfaceStyle</key>
    <string>Light</string>

要么

  1. 将此添加到您的AppDelegate.m
    if (@available(iOS 13.0, *)) {
        rootView.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
    }

Info.plist更改对我有用。谢谢
Manuel Hernandez

1
@Hazwin听起来不太可能
Maxim Zubarev

@MaximZubarev我想他指的是stackoverflow.com/a/56546554/827027
dwn

@Hazwin如果您使用的是Xcode的更新版本,则情况并非如此,对于阅读评论的人可能会产生误导。我在Info.plist中使用UIUserInterfaceStyle ligth在应用商店中拥有多个应用
Jero

1
@杰罗是的。我的错。我指的是stackoverflow.com/questions/56537855/...
Haswin
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.