Skip to content

Add ...children rest parameter to unstable_createElement - #2761

Merged
zoontek merged 2 commits into
necolas:masterfrom
faceyspacey:patch-5
Oct 21, 2026
Merged

zoontek merged 2 commits into
necolas:masterfrom
faceyspacey:patch-5

Conversation

@faceyspacey

@faceyspacey faceyspacey commented Feb 14, 2025 •

Copy link
Copy Markdown
Contributor

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.

@codesandbox-ci

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
Contributor 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
Copy Markdown

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!

Mirror `React.createElement(component, props, ...children)` as close as possible without breaking current implementation of unstable_createElement
@zoontek
zoontek force-pushed the patch-5 branch 2 times, most recently from 8604be8 to 54a02aa Compare October 21, 2026 18:07
@zoontek
zoontek merged commit 243f8d6 into necolas:master Oct 21, 2026
5 checks passed
@zoontek

zoontek commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

LGTM, thanks!

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.

3 participants