react-native-screens icon indicating copy to clipboard operation
react-native-screens copied to clipboard

UseHeaderHeight() returns 0 initially if a custom header is used

Open AjayFrancisTechversant opened this issue 7 months ago • 1 comments

Description

Current behavior:

The useHeaderHeight() returns 0 initially if a custom header is used. But once the device's orientation changes, it returns correct value. Im using native stack navigator. Please refer the uploaded screen recording. https://drive.google.com/file/d/1-CvfpQMP6c7j1Y2X_LJUjt53yJPrXp6Z/view?usp=sharing

Expected behavior:

It should return correct value for the height of custom header.

Steps to reproduce

  1. Clone The provided repo
  2. yarn install
  3. yarn android
  4. observe that the headerheight is 0 initially(even if there is a header) for the custom header. Once the device orientation changes, it returns the correct value

Snack or a link to a repository

https://github.com/AjayFrancisTechversant/dummyRepo

Screens version

4.11.1

React Native version

079.3

Platforms

Android, iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Release mode

Device

Real device

Device model

Samsung Galaxy s9+

Acknowledgements

Yes

AjayFrancisTechversant avatar Jun 06 '25 09:06 AjayFrancisTechversant

HI there ! In android the initial value of useHeaderHeight() is zero , but when the device is rotated , it will be returning correct value . In ios the initial value of useHeaderHeight() is correct, but when the device is rotated , the value will be changed to zero.

Prajwaltechversant avatar Jun 09 '25 12:06 Prajwaltechversant