GetStream / react-native-bidirectional-infinite-scroll

📜 React Native - Bidirectional Infinite Smooth Scroll
https://getstream.github.io/react-native-bidirectional-infinite-scroll/
MIT License
236 stars 27 forks source link

Jumping not solved on Android when scrolling up #8

Open lc3t35 opened 3 years ago

lc3t35 commented 3 years ago

First I would like to thank you for this publication with flat-list-mvcp and effort to solve the jumping problem on Android. In my case, after setting the maintainVisibleContentPosition, the jumping problem disappeared on iOS but still present on Android. Here is what happens on Android when scrolling up (scrolling down no problem) , flashing and jumping :

Bouncing on Android

I share some code snippets here so you can check if I made a mistake using FlatList :

import { FlatList } from 'react-native-bidirectional-infinite-scroll';

const viewConfigRef = useRef({
    itemVisiblePercentThreshold: 90,
    minimumViewTime: 200,
  });

  <FlatList
    data={moments}
    keyExtractor={keyExtractor}
    renderItem={renderMomentItem}
    horizontal={false}
    numColumns={1}
    viewabilityConfig={viewConfigRef.current}
    onViewableItemsChanged={onViewRef.current}
    ref={setRef}
    onScrollToIndexFailed={onScrollToIndexFailedMoments}
    onEndReached={loadMoreOlderMessages}
    onStartReached={loadMoreRecentMessages}
    onEndReachedThreshold={0.4}
    scrollEventThrottle={20}
    bounces={false}
    windowSize={5}   // tried without windowSize, with 5 or 10 same behaviour
    showsVerticalScrollIndicator={false}
    ListFooterComponent={
      momentLoading ? <ActivityIndicator size='large' /> : renderFooter
    }
    maintainVisibleContentPosition={{
      autoscrollToTopThreshold: undefined,
      minIndexForVisible: 0,
    }}
  />
vishalnarkhede commented 3 years ago

@lc3t35 So I think its the windowSize that needs to be modified here. Default value of windowSize is 21. You should keep it higher than 21, if you want to amend more than 10 results at a time.

Please let me know if that fixes the issue. I should also mention it in Readme somewhere :)

lc3t35 commented 3 years ago

@vishalnarkhede could you please solve https://github.com/GetStream/flat-list-mvcp/issues/13 which prevents me to test this issue ?

vishalnarkhede commented 3 years ago

https://github.com/GetStream/flat-list-mvcp/issues/13#issuecomment-812925583

vishalnarkhede commented 3 years ago

@lc3t35 Is the scroll jumping issue also resolved for you after upgrading to @stream-io/flat-list-mvcp@0.10.0-beta.0 (or beta-1)?

lc3t35 commented 3 years ago

Still the same with flat-list-mvcp@0.10.1 and windowSize = 22

vishalnarkhede commented 3 years ago

@lc3t35 ok let me try to setup an example with similar layout as your app!! I will get back to you

vishalnarkhede commented 3 years ago

@lc3t35 Could you share the keyExtractor function?

lc3t35 commented 3 years ago

const keyExtractor = (item) => item._id;

vishalnarkhede commented 3 years ago

_id ... Is it unique for every item? Thats really cruicial

vishalnarkhede commented 3 years ago

Please check the example on this branch - https://github.com/GetStream/react-native-bidirectional-infinite-scroll/tree/vishal/activity-example/example.

I have tried to generate the similar layout and config as your app!!

Screenshot 2021-04-10 at 19 53 23
lc3t35 commented 3 years ago

_id ... Is it unique for every item? Thats really cruicial

Yes I've checked that _id are unique for every item.

lc3t35 commented 3 years ago

Can't build example on android : https://github.com/GetStream/react-native-bidirectional-infinite-scroll/issues/11 (works fine on ios) -> solved This example is not exactly the same case :

vishalnarkhede commented 3 years ago

Is it possible for you to share the app codebase with me? I am happy to help figure out the issue!! Or if you can setup independent code example ... where you can replicate this issue, that will work as well.

Jojr commented 3 years ago
  • only images (I have also video)

I'm facing the same problem with videos only.

@stream-io/flat-list-mvcp": "^0.10.1 windowSize={60} // The high number I know, but it avoided the jumping