nativescript-community / ui-collectionview

Allows you to easily add a collection view (grid list view) to your projects. Supports vertical and horizontal modes, templating, and more.
Apache License 2.0
59 stars 18 forks source link

fix: Infinite recursion on scrollToIndex with vue3 component; #66

Closed tralves closed 1 year ago

tralves commented 1 year ago

In my vue3 project I was getting an infinite recursion doing (Android and iOS):

const listComponent = ref( null );

const scrollToBottom = () => {
    listComponent.value.$el.nativeView.scrollToIndex( 0, true );
};

The infinite recursion was happening int the function function scrollToIndex(index: number, animate = false) added here.

I just removed the function and it now works. I don't know why it was added. I couldn't access the function directly in the component with listComponent.value.scrollToIndex( 0, true );

Works well on both Android and iOS.

Thanks!

farfromrefug commented 1 year ago

@tralves just worried it would break for someone already using it

vallemar commented 1 year ago

@tralves @farfromrefug good! if before this made a tiny loop and now it works, it seems fine to me. I'll try to add another pr to be able to directly access the collectionview from .value since it's the expected behavior but this looks good!