react-native-reanimated
react-native-reanimated copied to clipboard
fix(android): Unable to update properties for view tag
Summary
Platform: Android
I catch this issue when use FlashList with large data and have animated update on each item. One element can be update/replace/recycle, so view tag can be update/remove too So, before update props, we check current view tag exist in UIManager or not.
Test plan
Before:
https://github.com/software-mansion/react-native-reanimated/assets/43195241/8f24027e-01d1-4af0-9bf6-8f611a14c6fa
After:
https://github.com/software-mansion/react-native-reanimated/assets/43195241/ccf439b9-8c76-4448-ad83-aaeae91e032b
Hi @MasonLe2497, Log
needs to be imported:
NodesManager.java:356: error: cannot find symbol Log.d("Reanimated-updateProps", "Skip update props cause viewTag not exist or have been removed!");
@MasonLe2497 Thanks for submitting the PR! I agree we should do something about this error. Instead of checking if the view exists before updating props, maybe we could wrap mUIImplementation.synchronouslyUpdateViewOnUIThread
and mUIManager.updateView
calls into try/catch
blocks? This way we can also avoid the error in case when the view exists when calling updateProps
on the UI thread but no longer exists when calling mUIManager.updateView
on the native modules thread.
@MasonLe2497 Thanks for submitting the PR! I agree we should do something about this error. Instead of checking if the view exists before updating props, maybe we could wrap
mUIImplementation.synchronouslyUpdateViewOnUIThread
andmUIManager.updateView
calls intotry/catch
blocks? This way we can also avoid the error in case when the view exists when callingupdateProps
on the UI thread but no longer exists when callingmUIManager.updateView
on the native modules thread.
Ok. I'll try tomorrow.(from UTC +7:00)
@tomekzaw i tried to wrap try/catch to mUIImplementation.synchronouslyUpdateViewOnUIThread, but i still catch the issue. I think synchronouslyUpdateViewOnUIThread run on different thread, so we cant catch nothing here
https://github.com/software-mansion/react-native-reanimated/assets/43195241/6bf0b55a-73c3-4ba5-9156-1d2ee667342a
Hi @MasonLe2497,
Log
needs to be imported:
NodesManager.java:356: error: cannot find symbol Log.d("Reanimated-updateProps", "Skip update props cause viewTag not exist or have been removed!");
Thanks, I just update my PR
Hey @tomekzaw, is there anything else we can do about this?
👀
@tomekzaw any update?
@ngocle2497 do you plan to review the change requests? We really need this in prod. If not, let me know and I'll do it.
@damianbeles @ngocle2497 I opened ticket #5767 to address that important error.
Thank you for your pull request and the time you've dedicated to it! I appreciate that 🙌. These changes have been implemented in this PR, so I'll close this one.