Expo SDK49升级后React Native状态栏及底部区域变白求助
问题:Expo SDK49升级后iPhone Expo Go状态栏及底部区域背景变白
将基于Expo SDK48开发的React Native项目升级至SDK49后,在iPhone的Expo Go中测试时,状态栏区域和视图底部变为纯白色,原本这些区域应匹配背景色#244A9F。尝试过StatusBar的backgroundColor属性(仅安卓生效)、设置translucent为true均无效。代码在Expo Snack的iOS模拟器中显示正常,怀疑是Expo Go或本地配置问题,希望解决该问题使白色区域匹配蓝色背景。
首页代码
import { StyleSheet, Text, View, SafeAreaView, StatusBar, Platform } from "react-native"; import { Link } from "expo-router"; export default function Page() { return ( <SafeAreaView style={styles.container}> <View style={{ height: Platform.OS === 'ios' ? 20 : StatusBar.currentHeight, }}> <StatusBar barStyle="light-content" hidden={false} translucent={false} /> </View> <View style={styles.main}> <Text style={styles.title}>Transit Sim</Text> <Text style={styles.subtitle}>Simulate your ticket</Text> <View style={styles.linkView}> <Link href="/home" style={styles.link}>Start</Link> </View> </View> </SafeAreaView> ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: "center", backgroundColor: "#244A9F", }, main: { flex: 1, justifyContent: "center", maxWidth: 960, marginHorizontal: "auto", }, title: { fontSize: 64, fontWeight: "bold", color: "white", }, subtitle: { fontSize: 36, color: "#38434D", color: "white", }, linkView: { height: "auto", width: 80, marginTop: 15, borderWidth: 2, borderRadius: 10, borderColor: "black", paddingTop: 2, paddingLeft: 5, paddingRight: 5, paddingBottom: 2, backgroundColor: "#fff", flex: 0, alignItems: "center", }, link: { fontSize: 25, } });
补充:代码在Expo Snack的iOS模拟器中显示正常。
内容的提问来源于stack exchange,提问作者user23329645
相关产品推荐
相关产品推荐

