software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.59k stars 1.26k forks source link

Add remark about reading SharedValue from the js thread #6160

Closed j-piasecki closed 5 days ago

j-piasecki commented 6 days ago

Summary

Reading from a shared value on the js thread may block the JS thread until the UI runtime finishes whatever it's doing. This isn't really communicated clearly and adding it to the docs seems like the best option as we don't want to show warnings.

Test plan

I asked ChatGPT to point out problems (it did).

joe-sam commented 1 day ago

This is confusing 🫡 and possibly requires some investigation. Shouldn't all Read operations on a shared objects be non-blocking unless there are one or more multiple write operation (object locks) on the object in question on the UI thread.