idibidiart / react-native-responsive-grid

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

'rtl' prop causes children to disappear #22

Closed peacechen closed 6 years ago

peacechen commented 6 years ago

The 'rtl' prop is passed down as an object, causing the children to fail to render. https://github.com/idibidiart/react-native-responsive-grid/blob/master/src/components/Row.js#L44

It should be passed down as object in an array.

peacechen commented 6 years ago

Fixed in #23

idibidiart commented 6 years ago

Thank you very much for this contribution.

I’m traveling without my laptop but will take a look a merge tonight or tomorrow after I get back home.

I think the Readme on size “cut offs” was out of sync with the code. I believe in the code the logic was consistent as far as the intervals go. I appreciate setCutoffs but would like to name it setResponsiveRanges or something like that.

Will take a look at Hidden and RTL

Much gratitude.

peacechen commented 6 years ago

Glad to be of help and that you're open to merging the PR.

The ScreenInfo code never evaluates MEDIUM_Width. It compares the width with the small and large cutoffs, and assumes that medium will be in there. The size ranges are difficult to grok because the small cutoff is the high end of the range, the medium cutoff somewhere in between small and large, and the large cutoff is at the low end of the range. I documented in the PR the actual computed ranges and updated the code to be consistent with where the cutoff occurs.

idibidiart commented 6 years ago

Oh that’s great. Sorry about the oversight.

When Ibhave time, I’d like to add unit unit tests (for size ranges) and snapshot tests for RTL, hidden, and the responsive behavior in general.

Will add you to Contributors.md and happy to incorporate any fixes and improvements.

I built this library for a project I was working on just over a year ago and have not used it since but I hope that will change at some point as I go back to RN.

Looking forward, if I get any time to spend with RN, it would be nice to support display:grid behaviors (at least common use cases) in userland. I don’t think Yoga is going to give us that capability any time soon. If you run into use cases for display:grid please feel free to create an issue so we can track it.

Will merge tonight. Thank you!

peacechen commented 6 years ago

display:grid is an interesting idea. We don't have a need for it yet and there's a lot on my plate before I can get to it. Initial thoughts are to create a wrapper that automatically computes the % of each column based on the number of columns (e.g. 10 display:grid columns creates 10 of 10% each). But that could be too simplistic and due to me not fully digesting the code.

Thanks for creating and sharing this library. It works quite well and hopefully we can keep improving it 👍