khevamann / rn-responsive-styles

Responsive styles for react-native and react-native-web
MIT License
39 stars 3 forks source link

Adds hook for conditional rendering #21

Closed khevamann closed 7 months ago

khevamann commented 1 year ago

closes #20

@matziol here is my idea for conditional rendering, I want to leave this PR open for a week or two and try this out in one of my projects/ see if I can get some feedback on this. But you are welcome to pull from this branch and let me know how this works for you/ if you have any suggestions

codecov-commenter commented 1 year ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (bcfc4d1) 98.26% compared to head (6880223) 98.63%. Report is 5 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #21 +/- ## ========================================== + Coverage 98.26% 98.63% +0.36% ========================================== Files 10 11 +1 Lines 115 146 +31 Branches 11 11 ========================================== + Hits 113 144 +31 Misses 2 2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

StefanWallin commented 7 months ago

I think this API naming is clean and clear, I think you should ship it if you are happy with it. I just tried your library out and realized that this thing was missing, didn't find anything in the README so I thought it didn't exist and wrote something halfbad myself using basically minSize(DEVICE_SIZES.MD).includes(currentSize), which is not too performant or elegant.

I only have one suggestion for this PR, and that is to add a section to the readme for conditional rendering.

matziol commented 7 months ago

closes #20

@matziol here is my idea for conditional rendering, I want to leave this PR open for a week or two and try this out in one of my projects/ see if I can get some feedback on this. But you are welcome to pull from this branch and let me know how this works for you/ if you have any suggestions

Sorry, I missed it somehow. I just installed from branch and tested it in my project. Everything is clear and works like a charm, thank you!

khevamann commented 7 months ago

@StefanWallin I have added documentation to the readme