facebookarchive / react-360

Create amazing 360 and VR content using React
https://facebook.github.io/react-360
Other
8.73k stars 1.23k forks source link

initialProps Issue #497

Closed moroneyk closed 6 years ago

moroneyk commented 6 years ago

We have been using initialProps to pass values from index.html to the root component index.vr.js. This method of operating was integrated into ReactVR in v1.3.0 (https://github.com/facebook/react-360/issues/195)

Following the migration to React360 this no longer seems to work. Is this a bug, or intentional behaviour? What is the recommended way to pass initial props to index.js with React360?

Thanks, Kevin

react-360@1.0.0 react-360-web@1.0.1 Mac/iOS/Android Chrome/Safari *Cardboard

andrewimm commented 6 years ago

The arg has just changed to be a more React-like API. I had assumed it was clear in the documentation – apparently not. I will add extra context around this.

When you create a new React Root, the second argument is your initial props:

r360.createRoot('ComponentOne', { / initial props / });

moroneyk commented 6 years ago

Hi,

Thanks, I missed that in the doc. It works fine passing the values in as suggested.

Kevin