This worked well with Reanimated 2, where shared values kept a copy of their value on JS thread, and the assumption about Reanimated 3, was that even though the read is synchronous, it's quick enough not to cause problems. This assumption was wrong since it can result in JS thread being blocked until the UI thread finishes its current work to allow for SV read.
This PR eliminates the necessity of reading from the shared value by relying on information already available on the JS thread to decide whether the shared value should be updated.
Test plan
Test on the Example app to make sure nothing breaks, and make sure that memorized gestures don't result in updating the shared value.
Description
In https://github.com/software-mansion/react-native-gesture-handler/pull/2037 support for memoizing gestures was added, which relied on reading the current handlers from the shared value and comparing them to the new ones.
This worked well with Reanimated 2, where shared values kept a copy of their value on JS thread, and the assumption about Reanimated 3, was that even though the read is synchronous, it's quick enough not to cause problems. This assumption was wrong since it can result in JS thread being blocked until the UI thread finishes its current work to allow for SV read.
This PR eliminates the necessity of reading from the shared value by relying on information already available on the JS thread to decide whether the shared value should be updated.
Test plan
Test on the Example app to make sure nothing breaks, and make sure that memorized gestures don't result in updating the shared value.