software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
5.85k stars 954 forks source link

Event callback is not running in ui thread. #2878

Closed NiuGuohui closed 2 weeks ago

NiuGuohui commented 2 weeks ago

Description

I was upgrade to RN0.74 and react-native-gesture-handler@2.16.0. But I found that all event callbacks (such as onBegin, onTouchesDown, onTouchesMove) run on the JS thread. Now I must wrap each callback function using runOnUI.

Steps to reproduce

  1. declare a variable in js thread.
  2. try to console this variable in onTouchesMove fn body.
  3. you can see that was print normally(But in fact, if it is in the UI thread, it cannot be read).

Snack or a link to a repository

none

Gesture Handler version

2.16.0

React Native version

0.74.0

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

Android emulator

Device model

No response

Acknowledgements

Yes

github-actions[bot] commented 2 weeks ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

m-bert commented 2 weeks ago

Hi @NiuGuohui! Thanks for reporting this issue! We have already merged fix for this problem. While it wasn't released in 2.16.0, you can expect it to be released by the end of the week.