react-native-reanimated icon indicating copy to clipboard operation
react-native-reanimated copied to clipboard

fix(android): Unable to update properties for view tag

Open ngocle2497 opened this issue 1 year ago • 10 comments

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.

Fix #4505 Fix #4231 Fix #3860

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

ngocle2497 avatar Oct 11 '23 17:10 ngocle2497

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!");

efstathiosntonas avatar Oct 11 '23 17:10 efstathiosntonas

@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.

tomekzaw avatar Oct 11 '23 18:10 tomekzaw

@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.

Ok. I'll try tomorrow.(from UTC +7:00)

ngocle2497 avatar Oct 11 '23 18:10 ngocle2497

@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

ngocle2497 avatar Oct 12 '23 02:10 ngocle2497

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

ngocle2497 avatar Oct 12 '23 02:10 ngocle2497

Hey @tomekzaw, is there anything else we can do about this?

ranaavneet avatar Nov 17 '23 16:11 ranaavneet

👀

thomazcapra avatar Nov 28 '23 18:11 thomazcapra

@tomekzaw any update?

damianbeles avatar Jan 26 '24 07:01 damianbeles

@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 avatar Jan 29 '24 11:01 damianbeles

@damianbeles @ngocle2497 I opened ticket #5767 to address that important error.

thomas-rx avatar Mar 07 '24 19:03 thomas-rx

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.

piaskowyk avatar May 13 '24 08:05 piaskowyk