Skip to content

[mixed-mode] [idea] More composability. #19

@trusktr

Description

@trusktr

Alright, so I've adopted react-famous into my latest project (finally!). It's working great out of the box composing things like Scene, Node, and DOMElement together (using those components directly).

But now what I'm trying to do is get more organized, so I've got something like this:

    React.render(
        <Scene style={{width: '100%', height: '100%'}}>
            <FeatureMapView boardId={board._id}>
                {_.map(cards, card =>
                   <Card context={card} />
                )}
            </FeatureMapView>
        </Scene>,
        this.$('.board-container')[0]
    )

where FeatureMapView extends Node,

import Node             from 'react-famous/Node'

class FeatureMapView extends Node {
    ...
}

and the Card component contains a Node and DOMElement instead of extending any of them:

class Card extends React.Component {

    render() {
        let card = this.props.context
        return (
            <Node>
                <DOMElement>
                    <BlazeCardWrapper context={card} />
                </DOMElement>
            </Node>
        )
    }
}

. The BlazeCardWrapper component just renders some normal HTML in the DOMElement.

The problem is, now that I've wrapped Node and DOMElement inside of my Card class, they don't become part of the scene graph as I was hoping. I was hoping to have the following hierarchy:

Scene
  FeatureMapView // (extends Node)
    Node // wrapped by Card, has DOMElement content

react-famous says

Error: Missing famous scene.

It would be great if we could allow for things to be wrapped/owned by other components in order to have more control of the scene graph composition.

Any ideas @pilwon?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions