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

Contexts - warning when crossing into ReactPIXI components. #15

Closed
netikular opened this issue Jun 24, 2015 · 4 comments
Closed

Contexts - warning when crossing into ReactPIXI components. #15

netikular opened this issue Jun 24, 2015 · 4 comments
Assignees

Comments

@netikular
Copy link
Contributor

I'm trying to use contexts in my application, and I'm finding that it is not working as expected.

The contexts come through just fine with the normal react classes that I'm creating, however as soon as I cross in to the react-pixi classes i lose the parent context, I've tried to make sense of the ReactContext stuff, but thought I would ask here if anyone else has run into the issue. I basically just want to make sure that the warning I'm getting is ok to ignore and I won't get stuck when react 0.14.0 comes out 😄

<div className="main-view">
  <Stage width={1024} height={768} backgroundcolor={0xFFFFFF} >
    <Background label={this.props.floor} zoom={this.props.zoom}/>
  </Stage>
</div>

Background looses the context some where.

@Izzimach Izzimach self-assigned this Jun 25, 2015
@Izzimach
Copy link
Owner

The underlying plumbing should be the same, so not sure why the context wouldn't get passed down.

You're just using getchildContext in a parent component and it doesn't show up in anything below the Stage?

@Izzimach
Copy link
Owner

Looks like when children are mounted they are given an empty context:

https://github.com/Izzimach/react-pixi/blob/master/src/ReactPIXI.js#L237

So this code needs to figure out the current context and pass that down instead.

@Izzimach
Copy link
Owner

Hm, some conflicts between parent context and owner context. Some references:

facebook/react#2112
https://gist.github.com/jimfb/0eb6e61f300a8c1b2ce7
facebook/react#3451

React 0.14 will switch to parent-based context, so those warnings might be a problem. Need a test case or two to make sure nothing breaks down the road.

Izzimach added a commit that referenced this issue Jul 1, 2015
@Izzimach
Copy link
Owner

Izzimach commented Jul 1, 2015

This appears to work for now. It's a bit ugly and will probably have to be re-visited for React 0.14

@netikular please re-open if you still have problems with contexts.

@Izzimach Izzimach closed this as completed Jul 1, 2015
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

No branches or pull requests

2 participants