React navigation Get stack navigator header height inside class component (without hooks)

Have you tried in your component something like this:

static contextType = HeaderHeightContext;

componentDidMount() {
   console.log(this.context); // this is your height
}

From documentation:

The contextType property on a class can be assigned a Context object created by React.createContext(). This lets you consume the nearest current value of that Context type using this.context

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top