react-native-community/hooks

Can't use Hook useDimensions

swarnava-bhattacharya opened this issue · 3 comments

I see many people on YouTube tutorials using this specific hook but I can't import it, did y'all remove it by any chance? And if so how can I replicate the same thing with a different hook?

It this what you are looking for?

https://reactnative.dev/docs/usewindowdimensions

To answer the original question. Yes they did on pr 322.
#322

The tutorial I am working is using @react-native-community/hooks v2.5.1.
Run npm install @react-native-community/hooks@2.5.1 if you want to run the tutorial as is but you are wise for just finding the updated hook for getting the same result.

I am not sure why this was removed but useWindowDimesions is not stable. I have opened new issue for tracking what is the reason behind it: #390

See the thread related to Dimensions API in RN. Thread seems to close due to inactivity but Dimension API is not stable. I was using that in one of my application and when I open alert on same screen. Dimension listener sends delay response due to which UI disturbs in application.
Thread for issue: facebook/react-native#29451