-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
setValue() has no effect before first render #419
Comments
I had same case. I downgraded to version: 1.1.0 and it worked |
The problem is worse than I thought: |
I'm having problems with |
Hello, I'm experiencing a similar issue described in #417 and #415 with a manual I'm on My use case: I have |
Yes it is |
Hey, @linfan68 Thanks again! For now, I close this issue. If you still have a problem, please let me know. |
@osdnk Is there any reason we can't add a check to see if the animation has mounted inside setValue? And if not, then update the startingValue, otherwise use the normal setter logic. It would just make things easier. My use case is that my component has an update method that updates values based on the state and props. If I call this inside the component's constructor then the values don't update. I can totally just pass in the initial value to the value constructor, but it'd be easier to not have to do that. |
Yes, there are situations where the initial value is not yet loaded when the node gets created. When the value gets loaded, it is just natural to call If the value gets updated between the node creation and the first render, this value update won't work because of this bug. @osdnk in case you think there aren't any legitimate use cases, please consider at least the confusion this bug might cause. I just spent an hour debugging this, and naturally I wasn't expecting the error to be in If fixing this bug is complicated, then at least throw an error if |
I'm getting a similar issue trying to manually |
We're also seeing this behavior.
There are plenty of legitimate use cases! In our case, we don't always mount the animated view in question, but we want the value to be correct when we mount it. It seems pretty clear to me that this is buggy behavior. |
…itially hidden Summary: More details in the [Notion task](https://www.notion.so/commapp/Cannot-send-message-in-sidebar-when-joining-a-drafted-thread-adebf4b621e44e719651086f8c6f9c08). Basically the `ChatInputBar` buttons aren't correctly animating in because `setValue` calls before a `Reanimated` Node is first mounted are [ignored](software-mansion/react-native-reanimated#419). Test Plan: See the Notion task for repro steps. I tested to make sure the bug was gone Reviewers: karol-bisztyga, palys-swm Reviewed By: palys-swm Subscribers: KatPo, Adrian, atul Differential Revision: https://phabricator.ashoat.com/D1397
It seems like setValue() call before render() function (before the animated value got bind to the UI) has no effect. See repro code below.
Basically I created an animated value with 0 as initial value, right before rendering I use setValue to change it's value to 100 and the value does not change (both from UI and debug log)
But if I wait for 0ms and set value, then the value got updated.
This is tested on 1.20. I'm still testing 1.30, but it seems worse (even with 100 ms delay the value still not got updated)
The text was updated successfully, but these errors were encountered: