airbnb / react-sketchapp

render React components to Sketch ⚛️💎
http://airbnb.io/react-sketchapp/
MIT License
14.94k stars 820 forks source link

context missing in react-sketchapp 1.0.0-beta.* used with a Sketch plugin #194

Closed weaintplastic closed 7 years ago

weaintplastic commented 7 years ago

Hey folks,

I was giving the latest beta version a try and figured out why it was breaking for us when used in a sketchapp plugin environment.

The main difference to the latest stable version is the use of context in some parts of the library as in https://github.com/airbnb/react-sketchapp/blob/master/src/render.js#L133 https://github.com/airbnb/react-sketchapp/blob/master/src/resets.js#L16

I'm not 100% sure where the reference to a global context is coming from but I guess this is available when executing the renderer via npm on the CLI. How is it possible to share the context that's available in a sketch plugin script with the react-sketchapp render() call?

I've also noticed that with the 1.* branch pages are cleared out before rendering. Is that something that is supposed to stay in the final version?

I'd be grateful for some feedback as I'm preparing our application currently for the 1.0 release.

Thank's a lot.

Roland

mathieudutour commented 7 years ago

make sure you are using the latest version of skpm, it's that which is setting the context globally

weaintplastic commented 7 years ago

@mathieudutour of course. my mistake. thanks for the hint.