New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Map and Set support #1228
Comments
Same issue that it took me some time to debug. If I'm defining a Map such that |
I attempted to use a plain object for this, and ran into some weird issues with rc.0.
Which would then be updated via However, when attempting to read Actually, even attempting to read it immediately after setting it would show stale data:
This especially manifests when a lot of JS calls try to update the value so it may be some sort of race condition between the UI and JS thread. I wasn't able to upgrade past rc.0, because even with rc.3 I'm running into |
@andreialecu Is this line is run in context of worklet? someValue.value = {...someValue.value, [key]: newValue } I think const [element, ...other] = array; if this code was run inside of worklet, while on usual JS side it is worked as expected. |
ref: https://docs.swmansion.com/react-native-reanimated/docs/shared-values#shared-values-vs-animatedvalue I guess this would explain the behavior above in the general sense. However I also tried wrapping the entire set call in In the mean-time got unblocked by using normal react |
I tried You could try it yourself if you need map-like behavior because it seems to work. The problem in my case was when I started updating it too fast. |
Let me try to rephrase it. That would be a feature request we can accept, but I can't guarantee we will implement something like this. |
From what I see apart from the feature request to support Thanks for sparing your time and have a nice day 😊 |
Would love to see this happen as well. |
Description
This support is required to store information about pages (rows grouped by pages) for
Animated.ScrollView
.Now, if I'm correct, there is no such support. And
Map
were treated as usual object (or was undefined) inside worklet, if was created throughuseSharedValue(new Map())
Caveats
Motivation
Track page ids and efficiently retrieve rows by this id (for adding or deleting rows on demand).
Also to use to store animated references.
The text was updated successfully, but these errors were encountered: