Search code examples
three.jswebvrreact-360

Native mobile app with React VR


I have a bit of experience with React JS & React Native. Now I have just started with React VR. From what I have learnt so far, one can use React VR to create virtual reality experiences in web pages.

I have a web application which uses Three JS to create a virtual walkthrough (using panoramic images). I wanted to know whether it is possible to create a native mobile app for the same using React VR and React Native.

My main reason for wanting to do this is to harness the power of the native hardware for better performance of the app. I hope to keep most of the existing Three JS code intact by making it work with React VR.


Solution

  • React VR is essentially a React-ive wrapper for Three.js. So, yes, you can keep most of your Three.js code intact and pop it into an a React VR app. You can simply pop your Three.js code into the Client.js file of a React VR app.

    Some of the newer phones are WebVR friendly (e.g. Google Pixel), and from my experience, work well with React VR apps. To this end, this does leverage the native hardware.

    However, as for combining React VR and React Native, in short, its not possible. React VR makes Views renderable via WebGl and leverages the WebVR API that many browsers are becoming equipped with these days.

    React Native on the other hand takes Views and renders them on a device as Java (android) or objective-C (iOS) Views. In short, React Native, at the time of writing this answer, does not have VR capabilities, and cannot be combined with React VR.

    Check out this informative link for a more detailed discussion.