react-native-community/hooks

Height invalid from useWindowDimensions

AlexandreMouyen opened this issue · 0 comments

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.