Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server-rendering styles that rely on dimension/layout APIs #1225

Closed
alidcast opened this issue Jan 10, 2019 · 1 comment
Closed

server-rendering styles that rely on dimension/layout APIs #1225

alidcast opened this issue Jan 10, 2019 · 1 comment

Comments

@alidcast
Copy link

is there a way to server render styles that rely on dimensions/layout APIs? the issue that is that since the window object is undefined in server, the styles are rendered incorrectly.

How should one handle server-rendering responsive styles with rnw?

Currently, I'm cloaking the app until the styles are updated with the correct dimensions.

@necolas
Copy link
Owner

necolas commented Jan 10, 2019

See the docs for Dimensions.set: http://necolas.github.io/react-native-web/storybook/?selectedKind=APIs&selectedStory=Dimensions. You can use whatever means you choose to infer the dimensions of the viewport that the server is rendering for, and set them there. Layout information is not available on the server and requires a client-side render.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants