-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
Custom Renderer API Support #7850
Comments
I think the intention is to move towards Fiber (#6170) which has a completely different API that does not use classes, today’s In the meantime, if you work on a custom renderer, I think you are encouraged to ship a copy of React reconciler. At least this is what React Native will do as far as I know. This means you aren’t affected by breaking changes in React repo master and can update your renderer at any time. It complicates setting up a custom renderer (you’ll need a script to keep your reconciler fork in sync with React repo) so it would be cool if somebody contributed that for RN and then other renderers could use that. It is not meant to be a long-term solution, but neither is our current renderer architecture. |
Yeah, I’m looking for something to maintain through the 15.4/16 release cycle primarily knowing that Fiber will change the world. It sound like you’re saying you’d rather see a hack from the community to sync the React Reconciler code out of this codebase (something that React Native can avoid by being in this repo) rather than expose something explicitly between the new build format being released and Fiber becoming official and stable? |
React Native doesn't plan to avoid it. On the opposite, there is an open diff for React Native to ship a copy of the reconciler that will be manually synced just like I described. This lets RN team experiment with changing the renderer code, and sync it at their own pace. Exposing the renderer as a package has pitfalls, the most significant one being unintentionally shared state between different renderers, like in #7386. |
Do you have a link to that open diff by chance? I couldn’t find it in my browsing of https://github.com/facebook/react-native/pulls |
I don't think it was submitted as a PR, more likely as an internal diff 😞 . |
I'll close as there are no plans to take extra steps to support custom renderers for stack reconciler while we're changing everything in Fiber. Fiber will have a first-class custom renderer support. |
Linking for future readers just for reference:
|
@gaearon Your much quoted tweet gave some great outlook already but it seems somewhat outdated by now and not sufficient to actually start digging into the topic |
I’m working through upgrading some renderers and documentation to the current master build (installing from http://react.zpao.com/builds/master/latest/).
From following along I knew there were some hard breaking changes I wanted to begin a discussion on what commitments React is willing to make at this time to support this use case.
Rather than trying to figure all of the current APIs needed up front I’d like to begin this by looking at the `Mount* entry point and discuss what APIs could be exposed and which should be covered in other APIs.
ReactMount
ReactMount, ReactNativeMount, and ReactTestMount are the entry points to three Facebook/React supported renderers. They all live in this codebase and have first class access to a number of internals that external renderers do not currently get.
Specifically, a few modules that each access are:
ReactReconciler
instantiateReactComponent
a helper function to create the correct React Component type (host, composite, text, ...). Also a part of the reconcilerReactUpdates
: my understanding is this is a part of ReactReconcilerReactInstrumentation
bridge between React internals and devtools (not limited to just the React DevTools(There are a few other modules that I see used between FB and my own renderers beyond these that may be worth future consideration, though these are what I understand to be the most important to unblock renderer development.)
My understanding is that a renderers
Mount
method is dependent upon the reconciler to bridge the renderer semantics to React core. The reconciler has become effectively private and non-shareable with the recent build changes.What can be done today to allow renderers to continue existing and experimenting in the 16.x release cycle?
A few initial ideas to get feedback on for possible direction (if any) would be acceptable. With both of these ideas comes developer/console warnings that this is an unsupported and non-guaranteed API that could break at any moment including patch releases:
ReactReconciler
packageThe text was updated successfully, but these errors were encountered: