viromedia / viro

ViroReact: AR and VR using React Native
MIT License
2.31k stars 483 forks source link

How to go back to react native's standard view #877

Open MinhazMM opened 4 years ago

MinhazMM commented 4 years ago

Environment

Please provide the following information about your environment:

  1. Development OS: Mac OS X
  2. Device OS & Version: iOS 13.5
  3. Version: ViroReact version: 2.17.0 & React Native version: 0.59.9
  4. Device(s): iPhone 11

Description

I am using Viro React to view VR videos. Initially the app opens a normal react native view and the user has the ability to select which VR video they wanna watch and it loads the video in VR using viro react.

So I am finding it hard to help the user go back to the react native view because i tried to change the state and navigate back but that just freezes the screen after it goes back....

Reproducible Demo

if (this.state.navigatorType == UNSET) {
...
} else if (this.state.navigatorType == VR_RANDOM_VIDEO) {
        return this._getRandomVRVideo();
} else if (this.state.navigatorType == VR_NAVIGATOR_TYPE) {
        return this._getSingleVRScreen();
}

This is how I change the state via the back button that is available on the top left corner of the VR video view

_exitViro = () => {
    this.setState({
    navigatorType: "UNSET"
   })
 }
doranteseduardo commented 4 years ago

Are you using a navigation component like react-navigator or wix/react-native-navigation? If so, just navigate as normal.

From your 'vanilla' screen navigate to another view which contains your Viro Navigation, whenever you're ready to go back to 'vanilla', just call the proper ::goBack or ::pop method from your navigation and you are done.

AvrilHunter commented 5 months ago

Hi @MinhazMM , did you manage to resolve this issue? We are having the same problem and :goBack doesn't seem to resolve it!