Questions tagged [react-360]

React VR lets you build VR apps using only JavaScript. It uses the same design as React, letting you compose a rich VR world and UI from declarative components.

React VR is a framework for the creation of VR applications that run in your web browser. It pairs modern APIs like WebGL and WebVR with the declarative power of , producing experiences that can be consumed through a variety of devices. Leveraging web technologies and the existing React ecosystem, React VR aims to simplify the construction of 360 experiences and democratize the creation of VR content. If you're familiar with React, you can now build in VR – learn once, write anywhere. React VR takes heavy inspiration from .

It was built and open sourced by Facebook in cooperation with Oculus and was first released on December 13th 2016.

While React VR is available as a standalone npm package, it's much easier to set up a new project by using the React VR CLI tool.

npm install -g react-vr-cli

Once installed, the CLI can be used to create a new project by running:

react-vr init PROJECT_NAME

Below is the starter template that your new project will contain:

import React from 'react';
import {AppRegistry, Pano, Text, View} from 'react-vr';

class WelcomeToVR extends React.Component {
  render() {
    // Displays "hello" text on top of a loaded 360 panorama image.
    // Text is 0.8 meters in size and is centered three meters in front of you.
    return (
      <View>
        <Pano source={asset('chess-world.jpg')}/>
        <Text
          style={{
            fontSize: 0.8,
            layoutOrigin: [0.5, 0.5],
            transform: [{translate: [0, 0, -3]}],
          }}>
          hello
        </Text>
      </View>
    );
  }
};

AppRegistry.registerComponent('WelcomeToVR', () => WelcomeToVR);

Official links

119 questions
3
votes
1 answer

Best way to integrate ReactVR inside an existing React app?

anyone can explain the best way to integrate a new ReactVR app inside an existing React app? I must iframe it or there is a way to integrate directly? Thanks
3
votes
2 answers

How do I keep some element fixed on the screen in react-VR

I want to keep a score or a health bar always visible in a react-vr app. I could use VrHeadModel - rotation, yawPitchRoll and position, but having to calculate it just to keep it fixed... seems like I am missing something. How do I do this?
Frazer Kirkman
  • 1,003
  • 1
  • 14
  • 23
3
votes
0 answers

React VR Image Border disappears after more elements appear

I have a View with the following markup. What's weird is that if I include more than one of these views in my module, some of the borders disappear. What's even more strange to me is that the borders are all there on page load, but then once all of…
Charlie L
  • 463
  • 2
  • 12
3
votes
1 answer

How do you tile a texture across a surface in React VR?

I have a box 100m x 100m to act as a floor in a reactVR test I am working on, I'd like to add a texture to it but the tile texture just stretches over the entire surface rather than tile, as desired. Here is my component code, nothing special: …
Anthony Cregan
  • 960
  • 11
  • 25
3
votes
3 answers

How to create react-vr "enter vr button/cardboard"?

I'm playing around with the react-VR framework and can't seem to find anything in the docs about entering vr mode on chrome/cardboard ? Any help or pointers much appreciated.
Chris O
  • 712
  • 2
  • 9
  • 20
2
votes
2 answers

React-360 Oculus Quest won't go into VR Mode

I have to be missing something: I installed node.js, installed react-360, created the Hello360 app but can't get the page to go into VR Mode in my Oculus Quest via the Oculus Browser. It just looks the same as it does on a PC. After googling for a…
Jamie
  • 21
  • 2
2
votes
1 answer

How to run two functions with VRbutton using React360?

Im very new react and getting the hang of the ropes. The current issue is that I have two functions that seemingly cannot be used at the same time using the Vrbutton (or any button) using onClick. I have tried many different methods (shown with my…
2
votes
1 answer

I want to change my quaternions coordinate to rotation coordinates

I am getting the quaternions coordinate [x,y,z,w] from a sensor. I want to change that coordinate so that I can rotate my React VR application scene to rotating that scene. I need to change the quaternions coordinate to the rotation coordinate. But…
2
votes
1 answer

Audio is not playing on iphone (react 360)

I am working very hard to get audio to play on my mobile phone with react 360. Through reading various documentation, I've learned that in order to play audio on mobile, I need to enact an html entity to create a user interaction. Once a user…
Dan Rubio
  • 4,709
  • 10
  • 49
  • 106
2
votes
1 answer

react-360 did not create project

I installed react-360 using npm install -g react-360-cli. But react-360 init Hello did not create any directory. I am using ubuntu 14.04.
user4016337
2
votes
1 answer

ReactVR global key press event listener

How, in ReactVR app, can I detect when user click some specific key? I have a function for catching this event but when I put it on View component like this this.handleInput(e)}> it catch it only when I have my cursor on some…
Alan Wołejko
  • 442
  • 2
  • 5
  • 20
2
votes
3 answers

How to change camera to 3rd person in React VR?

Composing a scene in React VR is somewhat cumbersome because you're always stuck in 1st person view which makes it hard to judge the depth at which objects are placed. By default the camera is placed at [0, 0, 0] coords, I'd like to know if there's…
Valentin
  • 2,772
  • 1
  • 27
  • 40
2
votes
1 answer

react vr border not working

I want to put a border around my text.
Lunny
  • 852
  • 1
  • 10
  • 23
2
votes
0 answers

World coordinates of ReactVR component

Is there a cross-platform way to get the absolute world coordinates of a ReactVR Component from within the component itself? I can't see any documented means of doing this, short of creating a custom native component. The use-case is driving…
timoxley
  • 5,156
  • 3
  • 36
  • 40
2
votes
0 answers

How to access a OS X user's file system with React VR?

I'm developing an Electron app that is running an instance React VR. The app enables a user to add and save content to a react-vr project by reading and writing the state from/to a JSON file. During development, this JSON file has been stored in…