There is extra space appearing above the react navigation header, but only when I have built an apk and run it on my phone. When using expo, there is no extra space. I am using a Samsung S21 to test. I am also using React Native Paper.
App.js
const Drawer = createDrawerNavigator();
export default function App() {
return (
<PaperProvider theme={theme}>
<NavigationContainer theme={navTheme}>
<Drawer.Navigator
initialRouteName="Home"
screenOptions={{ header: (props) => <Header {...props} /> }}
>
<Drawer.Screen name="Home" component={Home} />
<Drawer.Screen name="Compare" component={Compare} />
</Drawer.Navigator>
</NavigationContainer>
</PaperProvider>
);
}
Header.js
const Header = ({ route, navigation }) => {
const theme = useTheme();
const openDrawer = () => {
navigation.openDrawer();
};
return (
<Appbar.Header
safeAreaInsets={{}}
style={{
backgroundColor: theme.colors.darkPrimary,
}}
>
<Appbar.Action
icon="menu"
color={theme.colors.light}
onPress={openDrawer}
/>
<Appbar.Content color={theme.colors.light} title={route.name} />
</Appbar.Header>
);
};
export default Header;