我正在使用
SafeAreaView
中的 react-native-safe-area-contex
,但它似乎无法在 Pixel 8 Pro 上正常工作。
这是我在组件中使用它的方式:
import { Text } from "react-native";
import { useNavigation } from "@react-navigation/native";
import { useLayoutEffect } from "react";
import { SafeAreaView } from "react-native-safe-area-context";
const HomeScreen = () => {
const navigation = useNavigation();
useLayoutEffect(() => {
navigation.setOptions({
headerShown: false
})
});
return (
<SafeAreaView>
<Text>This is some text that shouldn't be hidden behind the camera notch but on Pixel it is</Text>
</SafeAreaView>
)
}
export default HomeScreen
我使用方法不对吗?