ReactVision/viro

onDrag not working at 2.23.0 [Update: react-native-reanimated issue]

Closed this issue ยท 12 comments

Environment

  1. Development OS: Mac
  2. Device OS & Version: iOS version (15.5)
  3. Version: ViroReact 2.23.0 and React Native version 0.68.2
  4. Device(s): iPhone 7, 11, XR, 13 Pro

Description

Property onDrag is not called on ViroNode or ViroBox etc.
On Rotate, onClick, OnClickState and every other event functions works.

This issue was not present in ViroReact of version 2.22.0

I've been experimenting with the set up of all different dragType values, dragPlane defined or not, highAccuracyEvents turned on and off. Nothing works...

Update:

The issue is present in React 18 only. onDrag works as expected on React 17.

After all it was the react-native-reanimated module (using by react-navigation etc.) that was causing the issue with dragging objects in viro scene.
I was able to bump the react-native version up to 0.68.2 together with react 18.2.0.

In this configuration onDrag event works only with the react-native-reanimated module of verion 2.5.0.

Versions less or higher than 2.5.0 ended up broking the dragging event.

@ViktorVojtek were you able to resolve without needing to remove react navigation?

Hey @genesy, no not really. I've ended up downgrading the viro to 2.22.0. In 2.23.0 I should be very specific with the other packages and make sure nothing will update without me noticed...

@ViktorVojtek Hi, Can you check with onPinch ? with Viro@2.22.0, onDrag & onRotate are worked but not onPinch

Even though I downgraded the version of react-navigation and related libraries (gesture, animated, screens...) and also the version of Viro, onPinch still doesn't work

@quangArchiviet Hi, you are right. OnPinch event doesn't work well on 2.22.0, I doesn't need that event for my application so I didn't know.
But events in viro are vary from device to device. I have issues with onRotate event on Xiaomi devices actually.

Apple devices works great, samsung is doing well, and Xiaomi are worst. Because of this I am trying to handle gestures outside of viro with react-native-gestures.

In my project I am using ver. 1.10.3 which is really old api, but I have to use it because of viro v. 2.22.0 and react navigation version I am using right now. I can't upgrade just yet.

Anyway, handling events outside of viro with gesture handler is promising to me and I am currently getting really good results from it.

I will let you know, when I finish this experiment and it would be a success.

Cheers,
Viktor

@ViktorVojtek

Most apps that allow AR experiences don't use pinch gestures. Same goes for the apps that I worked on before. But since I developed vrstyler.com and allowed people to sell models there. I noticed that there will be times when users want to resize the model in the AR environment when the model is designed to the wrong dimensions.

Maybe i will make an input[range] as a quick solution for it. ๐Ÿ˜„

@quangArchiviet range input is not actually a bad idea ๐Ÿ˜„

Thanks ๐Ÿ˜Š

My experiment with react-native gestures works, but the dependency throws some weird errors from native to react what causes laggs and unexpected termination of the app after a longer time of playing with the rotation for example...
And to make it work without any or at least any terminating issues it would take me another day or a few...

So considering this I'll go for the range input too for xiaomi devices.

@quangArchiviet Hi, I've responded to your entry in discord discussion by the following answer, so I am pasting it also here:

"I figured out that on react-native 0.67.5 and viro-react 2.23.0 all events works for me. Even onPinch and onRotate works really well on every device I've tesed and had issues before. I have to notice that it works good only if I have Bitcode enabled in Xcode for the whole project and every pods, same with proguard on android. Hope this helps."

Thanks bro! I will try it now ๐Ÿ˜†

@ViktorVojtek I tried but had not luck. onPinch and onDrag not worked again ๐Ÿ˜… Both React 17 and 18