-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Current Behavior
-
What code are you running and what is happening?
Hi, I noticed that when you are precisingheight
inheaderStyle
options, safe area paddings for devices with a notch are not taken into account.
That's a shame because if forces me to add manually the safe insets and it's not that convenient. -
Include a screenshot or video if it makes sense.
With default height:
const AccountStackNavigator = () => {
return (
<AccountStack.Navigator>
<AccountStack.Screen
name="Profile"
component={Profile}
options={{ title: 'Profile' }}
/>
</AccountStack.Navigator>
);
};
With custom height:
const AccountStackNavigator = () => {
return (
<AccountStack.Navigator>
<AccountStack.Screen
name="Profile"
component={Profile}
options={{ title: 'Profile', headerStyle: { height: 64 } }}
/>
</AccountStack.Navigator>
);
};
The header is smaller than the standard one, although the standard header is 44px high...
With custom height and insets:
const AccountStackNavigator = () => {
return (
<AccountStack.Navigator>
<AccountStack.Screen
name="Profile"
component={Profile}
options={{ title: 'Profile', headerStyle: { height: 64 + insets.top } }}
/>
</AccountStack.Navigator>
);
};
Expected Behavior
-
What do you expect should be happening?
I understand why insets are not taken into account, since you override the default param. But I'd like at least to be able to set a custom height and not having to deal with the safe areas.
Would it be possible? -
Include a screenshot or video if it makes sense.
I'd like have this result:
with this piece of code:
const AccountStackNavigator = () => {
return (
<AccountStack.Navigator>
<AccountStack.Screen
name="Profile"
component={Profile}
options={{ title: 'Profile', headerStyle: { height: 64 } }}
/>
</AccountStack.Navigator>
);
};
How to reproduce
You should be able to reproduce everything with the code snippets above.
Thanks !
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
- Either re-create the bug on Snack or link to a GitHub repository with code that reproduces the bug.
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
- Keep the repro code as simple as possible, with the minimum amount of code required to repro the issue.
- Before reporting an issue, make sure you are on latest version of the package.
Your Environment
software | version |
---|---|
iOS or Android | iOS 12+ |
@react-navigation/native | 5.0.10 |
@react-navigation/stack | 5.2.0 |
react-native-gesture-handler | 1.5.0 (do I need it with the RN nav v5?) |
react-native-safe-area-context | 0.6.0 |
react-native-screens | 2.0.0-alpha.12 (do I need it with the RN nav v5?) |
react-native | I guess it's expo 36's v0.60 |
expo | 36.0.0 |
node | 12 |
npm or yarn | 1.19.1 |