import { Test } from "./Test";
export default Test;
Expected Behavior
Actual Behavior
Context & more information
When looking at the SSR rendered result, you see that it shows no show in green, so SSR contains indeed styling information
to see the "Actual Behavior", remove the <StyleProvider /> in the layout. This results in the SSR result beeing unstyled though, which is not what we want
The Problem does not happen if you use react-native's styleSheets. There both SSR result and local rendering are consistent, so it looks like it has to be a styled-components problem, not a ReactNativeWeb problem
the problem happens if Styled-components mount on the client, but not on the server
extracting the Styled-components styles in the StyleProvider does nothing, but i kept it in the example for further reference. It was not clear to me whether to add it or not.
Environment
System:
Binaries:
Reproduction
here is a link to a repository that reproduces the problem:
https://github.com/macrozone/styled-components-rnw-reproduction
I added multiple scenarios.
Best run it locally (check it out, then
yarn dev
ornpm run dev
) and go to localhost:3000it shows links to multiple scenarios. The first one shows the actual problem reported here.
The others are cases work correctly (but are probably not what you want or have).
Steps to reproduce (as in the repo above)
I wrote these before creating the reproduction, so it may be easier to checkout the repo.
and StyleProvider like this:
and finally page.tsx:
Expected Behavior
Actual Behavior
Context & more information
no show
in green, so SSR contains indeed styling information<StyleProvider />
in the layout. This results in the SSR result beeing unstyled though, which is not what we want