quidone / react-native-wheel-picker

Wheel Picker for React Native
MIT License
52 stars 10 forks source link

bug: [Android] onValueChanged does not trigger or send wrong values sometimes #25

Open eeynard opened 4 days ago

eeynard commented 4 days ago

Hello,

I recently tried using your library, and it works great on iOS. However, I've encountered a couple of issues on Android. Specifically, the onValueChanged callback sometimes doesn’t trigger, or it returns an incorrect value. I’ve recorded a video demonstrating these issues and also created a simple Snack example for easy testing.

Issues demonstrated in the video:

I'm using a OnePlus 7T.

I’d appreciate any guidance or fixes you could provide for this behavior.

Thank you in advance!

Snack : https://snack.expo.dev/@eeynard_allocab/wheelpicker-android-issue

https://github.com/user-attachments/assets/e318d089-dea4-4ccc-9000-0725aa94580d

rozhkovs commented 4 days ago

@eeynard Thank you for your issue!

Please answer a few questions:

  1. Is the new or old architecture being used?
  2. What is the version of React Native?
  3. Build Debug or Release?

I have not been able to reproduce the problem, but I have suggestions that this may be due to the braking of the JS thread.

I see that you have a new reference to data and onValueChanged for each render, try to memorize them and see if it will work better or not.

At the moment, I understand that the conditions for calling onValueChanged are not implemented in the best way and it needs to be improved.

rozhkovs commented 4 days ago

In the near future, I will try to improve the onValueChanged call and remove the 300ms delay in calling the function. To potentially determine when scrolling stops,, use the onScrollBeginDrag, onScrollEndDrag, and onMomentumScrollEnd events.

eeynard commented 3 days ago

I accidentally forgot to save my code, but I did test it using a static dataset (you can see it in the updated snack). The issue still persists.

Is the new or old architecture being used?

old

What is the version of React Native?

Expo Go 52 => RN 0.76. And on my app Expo 51 => RN 0.74.5

Build Debug or Release?

I believe Expo Go runs in release mode, while my app was tested in debug mode.

Thanks for the feedback! I’ll look into finding a workaround in the meantime.