recyclerlistview icon indicating copy to clipboard operation
recyclerlistview copied to clipboard

refreshControl causes onScroll to stop working on Android when using Reanimted ScrollView

Open haibert opened this issue 2 years ago • 6 comments

Hello all,

I believe it is a known issue that assigning refreshControl while using reaniamted scrollview disables the onScroll prop. Is there any work arounds for this? Or is there a way we can provide some funding to accelerate the fix?

haibert avatar Sep 28 '21 17:09 haibert

ANy luck yet?

yasirrafiq786 avatar Oct 13 '21 23:10 yasirrafiq786

No, it's really unfortunate because the performance of this library is outstanding. But with fabric coming out soon maybe we'll all go back to flatlist and never worry again

haibert avatar Oct 14 '21 14:10 haibert

+1 you can check out my video result here in my response #654

Bayramito avatar Oct 15 '21 18:10 Bayramito

Same here

AlexSirenko avatar Oct 21 '21 15:10 AlexSirenko

I managed to fix this by using externalScrollView which extends BaseScrollView and passing the animated value via RecyclierListView scrollview props:

const animVal = new Animated.Value(0);

<RecyclerListView {...props} externalScrollView={ExternalScrollView as any} scrollViewProps={{ offsetY: animVal }} />

class ExternalScrollView extends BaseScrollView { scrollTo(...args) { if (this._scrollViewRef) { this._scrollViewRef.scrollTo(...args); } }

render = () => { return ( <Animated.ScrollView {...this.props} ref={scrollView => (this._scrollViewRef = scrollView)} onScroll={Animated.event( [ { nativeEvent: { contentOffset: { y: this.props.offsetY }, }, }, ], { useNativeDriver: true, listener: e => { //override the on scroll event listener here console.log(e) this.props.onScroll(e); }, } )} scrollEventThrottle={16} > {this.props.children} </Animated.ScrollView> ); }; }

Alt Text

ssokhavirith avatar Oct 25 '21 07:10 ssokhavirith

Thank you for the tip but I am using reanimated, which I guess isn't fully supported yet

haibert avatar Oct 25 '21 14:10 haibert