I'm building my first app with React Native and I'm using Expo to build my app. My problem is whenever I build my app there comes this extra white space / padding on top of my app. I have tried using SafeAreaView with flex: 1 but it doesn't fix the issue. Has anyone had this kind of issue before?
Managed to solve it using StatusBar component inside my header title component
I had the same issue.
Adding this to App.tsx solved it for me:
Platform.OS === "android" && StatusBar.setBackgroundColor("transparent");
Platform.OS === "android" && StatusBar.setTranslucent(true);
For me, it was the Android StatusBar.
https://docs.expo.dev/guides/configuring-statusbar/
androidStatusBar.translucent Value type - boolean. This option can be used to specify whether the status bar should be translucent. When false, the system status bar pushes the content of your app down (similar to position: relative). When true, the status bar floats above the content in your app (similar to position: absolute).
So I updated app.json, adding:
"androidStatusBar": {
"backgroundColor": "#00000000",
"translucent": true
},
What happened to me, is that I forgot to setup the expo-router. You need to use the property headerShown: false
.
in my scenario, thats how it goes: screenshot of the code
© 2022 - 2024 — McMap. All rights reserved.