idibidiart / react-native-responsive-grid

Bringing the Web's Responsive Design to React Native
Other
379 stars 42 forks source link

Fixed screen info pr #28

Closed idibidiart closed 6 years ago

idibidiart commented 6 years ago

@peacechen please see comments on PR #26 and review this

peacechen commented 6 years ago

@idibidiart

There is a project to render RN in the browser (react-native-web). The container in that case could be 0 size for various reasons. Sometimes web developers use that to hide components, or during resizing it could momentarily go to 0. An easy guard for the initialization case is to init _screenWidth & _screenHeight to -1 instead of 0. Dimensions should never return negative values.

idibidiart commented 6 years ago

Yes Ir simply initialize to undefined since they will be calculated anyway and cached. Will do.

idibidiart commented 6 years ago

set all initial values to null, in case Width and Height come back as 0 or undefined

pushed and published