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

Add ...children rest parameter to unstable_createElement #2761

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

faceyspacey
Copy link

@faceyspacey faceyspacey commented Feb 14, 2025

Mirror React.createElement(component, props, ...children) as close as possible without breaking current implementation of unstable_createElement.

This provides a way forward for passing children via the rest parameter, which allows a variable number of a children without warning about missing key props as occurs with props.children.

Mirror `React.createElement(component, props, ...children)` as close as possible without breaking current implementation of unstable_createElement
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8604be8:

Sandbox Source
react-native-web-examples Configuration

@quantizor
Copy link

I decided to fork this repo to apply the patch and make it available: https://www.npmjs.com/package/react-native-web-fork

The easiest way to use it is probably this package.json override:

{
  "overrides": {
    "react-native-web": "npm:react-native-web-fork"
  }
}

There are other patches applied as well, noted in the package README up top.

@faceyspacey
Copy link
Author

Sick. You know what you really want for your fork: the layout animation API working. People made progress on it in the past.

https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver

https://youtu.be/5N_VKQO-oFs?si=T5tMxTj4d8zbBFTk

https://www.youtube.com/live/S6fHb5ChG0A?si=HS-fT5eyH89pKIj0
56 minutes

Check apple's SwiftUI site for how they do animations. Basically the RN layout animation api is that. And recently Android RN finally started supporting it better. It would be really dope to get this working and then write a custom animation library on top of it to ease many common things.

https://developer.apple.com/tutorials/swiftui/animating-views-and-transitions

Their withAnimation API is RN's Layout Animation API.

@quantizor
Copy link

Sick. You know what you really want for your fork: the layout animation API working. People made progress on it in the past.

https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver

https://youtu.be/5N_VKQO-oFs?si=T5tMxTj4d8zbBFTk

https://www.youtube.com/live/S6fHb5ChG0A?si=HS-fT5eyH89pKIj0 56 minutes

Check apple's SwiftUI site for how they do animations. Basically the RN layout animation api is that. And recently Android RN finally started supporting it better. It would be really dope to get this working and then write a custom animation library on top of it to ease many common things.

https://developer.apple.com/tutorials/swiftui/animating-views-and-transitions

Their withAnimation API is RN's Layout Animation API.

Send me a PR!

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

Successfully merging this pull request may close these issues.

2 participants