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

Start putting the fiber docs together #24

Merged
merged 13 commits into from
Apr 19, 2017
Merged

Start putting the fiber docs together #24

merged 13 commits into from
Apr 19, 2017

Conversation

iamdustan
Copy link
Owner

No description provided.

@oatkiller
Copy link

👍 Not sure if this is ready, but I am eager to learn!

Now flow can tell us how to install all the things!

```
�  fiber git:(fiber) � flow
ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `appendChild`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `appendInitialChild`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `commitMount`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `commitTextUpdate`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `commitUpdate`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `createInstance`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `createTextInstance`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `finalizeInitialChildren`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `getChildHostContext`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `getPublicInstance`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `getRootHostContext`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `insertBefore`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `prepareForCommit`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `prepareUpdate`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `removeChild`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `resetAfterCommit`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `resetTextContent`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `scheduleAnimationCallback`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `scheduleDeferredCallback`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

ReactTinyFiber.js:30
 30: const ReactFiberReconciler : (hostConfig: HostConfig<*, *, *, *, *, *, *,
*>)=> Reconciler<*, *, *> = require('react-dom/lib/ReactFiberReconciler');
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
property `shouldSetTextContent`. Property not found in
 39: const TinyRenderer = ReactFiberReconciler({
                                               ^ object literal

Found 20 errors
```
@iamdustan iamdustan mentioned this pull request Mar 1, 2017
11 tasks
@ManasJayanth
Copy link

@iamdustan First off, great work. Love this repo. Based on TinyRenderer I did manage to write a bare basic dom and canvas renderer. (I can share it if you like).

Do you have any kind of notes/links/react PRs/github comments that can be referred. 1. I'd like to contribute here. 2. I want to make sure I'm on the right path writing renderers for fiber.

@iamdustan
Copy link
Owner Author

Oh I suppose I could land this 😅

@prometheansacrifice I don’t have any PRs for reference off-hand, but I do want to add those references to this repo/documentation as relevant.

@ManasJayanth
Copy link

Here's what I dug up

  1. First fiber commit using a Noop Renderer: New Reconciler Infra
  2. First commit integrating Host environment API: Host environment side-effects
  3. Paul Irish's links
  4. List of Fiber PRs

@ManasJayanth
Copy link

Appendix files are empty. Most likely, what is going to be the content of Rendering-A-Top-Level-Element and Reconcile-Transaction?

@kevzettler
Copy link

Is this good to merge? I'm attempting to write a renderer and found this repo. Seems the /stack examples are not up to date and fiber is about to land in react. Should I use this branch as a resource?

@kevzettler
Copy link

@prometheansacrifice I would appreciate a look at your canvas renderer if you don't mind

@ManasJayanth
Copy link

ManasJayanth commented Apr 19, 2017

@kevzettler Just to illustrate, I've put together a snippet. Try it with a simple component like

const HelloWorld = ({ name }) => <div>Hello there <span>{ name }</span></div>;

It will however fail for stateful components.

class HelloWorld extends Component {
  constructor() {
    super();
    this.state = {
      counter: 0
    };
  }
  componentDidMount() {
    setInterval(() => {
      this.setState((state, props) => {
        return {
          counter: state.counter + 1
        };
      });
    }, 1000);
  }
  render() {
    return (
      <div>
      counter is <span>{ this.state.counter }</span>
      </div>
    );
  }
}

Canvas is a immediate mode api and doesn't work well as is. You might want to look at ART and use it to write a renderer yourself (Though react officially has react-art) I did get a chance to write this myself, but let me know if I can help.

Which brings me to another question: Is react suited only for retained mode graphics? (Will probably open a SO question)

@iamdustan
Copy link
Owner Author

A bit premature perhaps, but I’ll still land this for now. It won’t work with the latest React 16 releases due to flat bundles, but if you stumble across this you can follow facebook/react#9103 for whenever a solution does land.

@iamdustan iamdustan merged commit 7e46ffa into master Apr 19, 2017
@iamdustan iamdustan deleted the fiber branch April 19, 2017 13:27
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.

4 participants