繁体   English   中英

如何更改 IOS 启动画面上的状态栏颜色

[英]How to change status bar colour on splash screen for IOS

是否可以在 React Native Expo 应用程序中更改 IOS 上的初始屏幕状态栏颜色?

在其他屏幕上,我像这样使用 React Natives useFocus:

  const isFocused = useIsFocused();
{isFocused ? <StatusBar style="light" /> : <StatusBar style="dark" />}

如何在 IOS 的初始屏幕上实现这一点?

启动画面不是 JS 线程的一部分,它是本机应用程序的一部分,您无法通过 JS 控制它。 这意味着您需要以编程方式为两个平台设置它或使用特殊的库和 CLI,如https://github.com/zoontek/react-native-bootsplash#setup

对于 expo 你可以试试这个配置https://docs.expo.dev/tutorial/configuration/#step-3-configure-the-splash-screen-background-color

对于 android,本指南可以帮助创建启动画面https://www.geeksforgeeks.org/how-to-change-the-color-of-status-bar-in-an-android-app/自定义主题.

对于 IOS 本指南是关于状态栏颜色https://sarunw.com/posts/change-status-bar-text-color-in-uikit/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM