ReactVision / viro

ViroReact: The AR and VR library for React Native 📳💙💛🤍💚
MIT License
1.31k stars 149 forks source link

Scoping issue with latest release #118

Open Vednus opened 2 years ago

Vednus commented 2 years ago

Environment

Please provide the following information about your environment:

  1. Development OS: Mac
  2. Device OS & Version: iOS version 15
  3. Version: ViroReact 2.23.0 and React Native 0.66.4
  4. Device(s): What device(s) are you are seeing the issue on: iPhone 12 Pro

Description

I'm getting undefined is not a function here because incrementSceneReference is undefined. I think it's a scoping issue where you need to bind your methods to this or instead use arrow functions. I haven't used class components in a while, so I'm a little rusty, but I'll keep investigating and try to find a solution.

Vednus commented 2 years ago

The problem was I was referencing push() from the arSceneNavigator property of the ref on the ViroARSceneNavigator. But, if I call push() directly on the ref of <ViroARSceneNavigator />, then it works. I'm not sure if this is the way you want it to work. It seems like any reference to arSceneNavigator.push() will have some scoping issues.

wmt-rn-shubham commented 2 years ago

Facing the same issue with the ViroScene Component. I am getting TypeError: undefined is not an object (evaluating 'this.props') Screenshot from 2022-07-08 12-25-00