feat: return nearest parent header height for useHeaderHeight

This commit is contained in:
Satyajit Sahoo
2021-03-12 01:59:40 +01:00
parent 2c8401d5cb
commit 24b3f739da
2 changed files with 9 additions and 2 deletions

View File

@@ -119,6 +119,8 @@ function CardContainer({
scene,
transitionSpec,
}: Props) {
const parentHeaderHeight = React.useContext(HeaderHeightContext);
const handleOpen = () => {
const { route } = scene.descriptor;
@@ -263,7 +265,9 @@ function CardContainer({
<HeaderShownContext.Provider
value={isParentHeaderShown || headerShown !== false}
>
<HeaderHeightContext.Provider value={headerHeight}>
<HeaderHeightContext.Provider
value={headerShown ? headerHeight : parentHeaderHeight}
>
{renderScene({ route: scene.descriptor.route })}
</HeaderHeightContext.Provider>
</HeaderShownContext.Provider>