sghiassy / react-native-sglistview

SGListView is a memory minded implementation of React Native's ListView
MIT License
743 stars 72 forks source link

scrollTo is not a function #20

Closed greatwitenorth closed 7 years ago

greatwitenorth commented 8 years ago

I was hoping for SGListview to be a drop in replacement for ListView. I'm using the scrollTo method to scroll to different portions of the list. Is this not support with SGListview?

rreusser commented 8 years ago

I wonder if it could make use of react-native-scrollable-mixin. I think this basically does what you're describing and passes scrollTo to the relevant inner scrollview-like ref.

greatwitenorth commented 8 years ago

I'm a bit unclear on how I'd use that to access the underlying scrollTo functionality of ListView. Wouldn't scrollable-mixin need to be implemented in SGListView.js?

rreusser commented 8 years ago

Sorry for the vagueness. Yes, that's correct. It's not magic but at least exposes a common interface so that these things mostly just work.

greatwitenorth commented 8 years ago

So I was able to implement the mixin easy enough by simply copying you library files into my project and adding the mixin. The trouble is when I scroll to a section in the list it appears to loose all the memory reducing benefits of SGLists. My memory is now climbing in a linear fashion like before. Is this because the scrollTo method is circumventing your memory management methods?

gre commented 8 years ago

@greatwitenorth you can use the underlying scrollTo in 2 ways:

sglistviewRef.getScrollResponder().scrollTo
sglistviewRef.getNativeListView().scrollTo

IMO the first appraoch is the best because it works both for ListView and SGListView

pesterhazy commented 8 years ago

@gre's approach worked perfectly, thanks Gaetan!

skizzo commented 7 years ago

Why is this issue still open? The method using getScrollResponder() works perfectly 👍

BennyTian commented 7 years ago

fixed:

sglistviewRef.getScrollResponder().scrollTo sglistviewRef.getNativeListView().scrollTo

thanks @gre

sghiassy commented 7 years ago

Thanks all. Closing