Skip to content

Height invalid from useWindowDimensions #231

@AlexandreMouyen

Description

@AlexandreMouyen

Hello there,

I am using the height value from useWindowDimensions in Expo.
I am on an iPhone 10 so height is 812, most of the time. But there are sometimes where the hook returns 70 instead of 812.

const { height } = useWindowDimensions();
const { bottom, top } = useSafeAreaInsets();
const bottomOffset = height - bottom - 40;

console.log(`${height} - ${bottom} - 40 = ${bottomOffset}`);

Working result is "812 - 34 - 40 = 738" and sometimes I have "70 - 34 - 40 = -4".

Does somebody know about this?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions