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

AppConsumer does not work if Pixi application not has been created using Stage #54

Closed
bichotll opened this issue Oct 16, 2018 · 5 comments

Comments

@bichotll
Copy link
Contributor

Description

The AppConsumer returns { app: undefined } when the app is not created using component.

Steps to reproduce

See example one: https://codepen.io/anon/pen/YJYxRZ?editors=0010 (Notice console.log on line 19)
See example two (original example): https://codepen.io/inlet/pen/aYLvrZ?editors=0010

Additional info

@inlet
Copy link
Collaborator

inlet commented Oct 16, 2018

Hi @bichotll,

If you're using a custom renderer (= without the Stage), make sure to wrap your stuff in the AppProvider:

<AppProvider value={app}>
   ...
</AppProvider>

You can see that the Stage does exactly the same:
https://github.com/inlet/react-pixi/blob/cf8c89bcfd6620cdba0d4efc43650b8389c047d1/src/stage/index.js#L150

Here's an updated version of your codepen:

https://codepen.io/inlet/pen/0d6625478cc5abb53f783e571e91b612/

@inlet inlet closed this as completed Oct 16, 2018
@inlet
Copy link
Collaborator

inlet commented Oct 16, 2018

See example two (original example): https://codepen.io/inlet/pen/aYLvrZ?editors=0010

Is this not working? Seems to work here 😉

@inlet
Copy link
Collaborator

inlet commented Oct 16, 2018

Maybe we should update the docs with an example of AppProvider

@bichotll
Copy link
Contributor Author

See example two (original example): https://codepen.io/inlet/pen/aYLvrZ?editors=0010

Is this not working? Seems to work here 😉

I just wanted to show the original example 👍 It works.

Maybe we should update the docs with an example of AppProvider

That could be useful in case someone comes across this issue.

@inlet
Copy link
Collaborator

inlet commented Oct 16, 2018

👍 thanks!

I'll update the docs

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