Skip to content
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

New items are sometime placed in the wrong postion #286

Open
fbeccaceci opened this issue Feb 27, 2025 · 5 comments
Open

New items are sometime placed in the wrong postion #286

fbeccaceci opened this issue Feb 27, 2025 · 5 comments

Comments

@fbeccaceci
Copy link

Registrazione.schermo.2025-02-27.alle.20.42.12.mov

If you look at the video you can see that the item number 15 is placed on top of item number 1

This tested in the example app, v1.3.1 on Fabric, no modifications to the code. Also happening on iOS.

Actually i figured this out because of a similar problem i'm having in the app i'm developing (but didn't manage to replicate in the example app, don't know why) where on iOS everything works fine, while on Android the last item added is invisibile

It has something to do with the layout i guess, removing the "layoutStyles" in the Animated.View in DraggableView.tsx, although the whole layout became wrong, let the last item to be visible

@MatiPl01
Copy link
Owner

MatiPl01 commented Feb 27, 2025

This is also a Reanimated issue. I have also seen that before and it is an issue related to layout animations on the New Architecture.

You may try disabling entering animation (set itemEntering to null) but you may still encounter the issue as there is a bug with React view recycling in layout animations and sometimes animations are apllied to incorrect views. It is a bit tricky and I don't know exactly how it works under the hood as I am not responsible for implementation of layout animations in Reanimated.

When you start scrolling or press on the misplaced view, it should appear on a correct position. I know that this is annoying but it's not an issue with this library.

@fbeccaceci
Copy link
Author

I didn't know Reanimated had all these problems on the new arch, do you know if with v4 some of those will be fixed?

@MatiPl01
Copy link
Owner

I didn't know Reanimated had all these problems on the new arch, do you know if with v4 some of those will be fixed?

Currently nobody is working at them. I think that the scrollTo issue is mostly related to how the New Architecture is designed and we may have to wait until Meta fixes some design problems on their side.

When it comes to layout animations, I think that it may be possible to be fixed on our side in Reanimated but, as I heard, the problem is more complex than it seems to be.

I will take up this topic on the next meeting that we have in the next week. I hope that we will able to fix at least this layout animations issue before the release of stable Reanimated 4, but, as I said, we are currently working on other things, so I can't promise.

@MatiPl01
Copy link
Owner

I will try to figure out a workaround on my side. Maybe I would be able to somehow fix this misalignment issue by getting rid of layout animations/transitions I use under the hood or by doing something else.

I will let you know once I have more information about this issue.

@MatiPl01
Copy link
Owner

MatiPl01 commented Mar 1, 2025

Hey @fbeccaceci!
I've just upgraded React Native, React and Reanimated dependencies to their latest versions in the #287 PR. I tested this example after the upgrade and I can no longer see this issue on the New Architecture on Android.
Could you please test it out on your side when you have time and let me know if the dependencies upgrade works for you as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants