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

Fix react/dom parse style array #25548 #25549

Closed
wants to merge 1 commit into from

Conversation

linjinze999
Copy link

Summary

How did you test this change?

Copy link
Collaborator

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some tests for server rendering, client rendering and hydration?

Not sure if this will accepted given that this can be implemented in userland by just merging/spreading the objects

@linjinze999
Copy link
Author

#25548

  1. I have added the style tests.
  2. React Native support array of styles.
The style prop can be a plain old JavaScript object. That's what we usually use for example code. 
You can also pass an array of styles - the last style in the array has precedence, so you can use this to inherit styles.

Use renderToString to parse React Native code will be error :
renderToString(<Text style={[{left:0}, {right:0}]}>array of styles</Text>) => style="0:[Object],1:[Object]"

@eps1lon
Copy link
Collaborator

eps1lon commented Oct 31, 2022

Use renderToString to parse React Native code will be error :

You're changing code for rendering react-dom components though. Rendering components that target a different renderer (here: react-native) is not supported by react-dom/server.

It sounds like you have a use case for rendering React Native to a string? I would suggest filing this as a feature request against https://github.com/facebook/react-native

@linjinze999
Copy link
Author

Do React consider adding array style properties? I think it's very useful.

Copy link

github-actions bot commented Apr 9, 2024

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@github-actions github-actions bot added the Resolution: Stale Automatically closed due to inactivity label Apr 9, 2024
Copy link

Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!

@github-actions github-actions bot closed this Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Resolution: Stale Automatically closed due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: react-dom/server renderToString don't support array style(react-native ssr)
3 participants