lightbasenl / react-native-panorama-view

A simple component for displaying panoramic images in your React Native app.
MIT License
127 stars 47 forks source link

Motion Tracking not working in iOS (Solution Included) #25

Open WarpSpade opened 4 years ago

WarpSpade commented 4 years ago

Motion tracking does not work on iOS, even with enableTouchTracking set to false. This seems to be because CTPanoramaView's default controlMethod is touch. Suggested change to ios/PanoramaView.m:

-(void)setEnableTouchTracking:(BOOL)enableTouchTracking
{
    if (!enableTouchTracking) {
        _panoView.controlMethod = CTPanoramaControlMethodMotion;
    }
}
WarpSpade commented 4 years ago

@rodymolenaar I've created a PR with this change, if you could please include it

Oyzuu commented 3 years ago

To automatically fix this after a pod install, you can add a replace instruction in the post install phase of your Podfile:

  post_install do |installer|
    system("sed -i '' 's/CTPanoramaControlMethodTouch/CTPanoramaControlMethodMotion/g' '../node_modules/@lightbase/react-native-panorama-view/ios/PanoramaView.m'")
  end

Using sed on Mac but this looks promising on Windows.

Have fun.