khevamann / rn-responsive-styles

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

SSR Support #19

Closed khevamann closed 1 year ago

khevamann commented 1 year ago

This PR adds support for frameworks that use SSR like NextJS. In addition it adds an example of how to implement this in a Nexpo app. The way this is handled is similar to other libraries tha wait until the code is running on the client to render the app. It will return a placeholder while rendering on the server then hydrate and render the app once it reaches the client.

closes #17 which was first observed by @JinbeiStudio but took a long time for me to be able to reproduce and get a fix in

codecov-commenter commented 1 year ago

Codecov Report

Merging #19 (776efca) into main (c2503f9) will increase coverage by 0.22%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #19      +/-   ##
==========================================
+ Coverage   98.03%   98.26%   +0.22%     
==========================================
  Files           9       10       +1     
  Lines         102      115      +13     
  Branches        7       11       +4     
==========================================
+ Hits          100      113      +13     
  Misses          2        2              
Impacted Files Coverage Δ
src/providers/BreakpointsProvider.tsx 100.00% <ø> (ø)
src/hooks/useDeviceSize.ts 87.50% <100.00%> (ø)
src/index.ts 100.00% <100.00%> (ø)
src/providers/SSRProvider.tsx 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more