Description
Introduction
A lot of React Native consumers rely on the screen and window dimensions to compute their layouts. Yet, after 5 years of React Native releases, this module is still unreliable. The frustration of users is palpable:
- Dimensions.get('window') is not returning the current values on Android facebook/react-native#29323 (comment)
- Dimensions.get('window') is not returning the current values on Android facebook/react-native#29323 (comment)
- Dimensions.get('window').height returns wrong height on Android with notch facebook/react-native#23693 (comment)
- Dimensions.get('window').height returns wrong height on Android with notch facebook/react-native#23693 (comment)
- Dimensions.get('window').height returns wrong height on Android with notch facebook/react-native#23693 (comment)
- Dimensions.get('window').height returns wrong height on Android with notch facebook/react-native#23693 (comment)
Details
The issue facebook/react-native#23693 has moreover been closed with a dubious rationale, "we've been provided with a hacky workaround, and you could use a third-party library, so I am going to close". For a lot of users, this attitude is infuriating, and makes them wonder what kind of dysfunctional human resources management at Facebook is ruling behind the scene.
Imagine a browser for which document.clientWidth and document.clientHeight behavior would depend on versions, platforms, etc... This is untenable for a project of this reach. Dimensions module is supposed to be a building block, it is expected to have an excellent test coverage, including on-device.
Discussion points
In my opinion, there are three ways to address the issue:
- Put maximum efforts to make this module reliable, and commit publicly about it;
- Deprecate the module, and recommend third-parties instead;
- Deprecate React Native.
Don't get me wrong, React Native can be awesome. But I believe the community could be treated will a little more care, and I strongly recommend decision makers to take into account the image they project through their policies in Open Source communities.