@@ -371,6 +371,7 @@ const MessageListWithContext = <
371371 const flatListRef = useRef < FlatListType <
372372 MessageType < At , Ch , Co , Ev , Me , Re , Us >
373373 > | null > ( null ) ;
374+
374375 const initialScrollSet = useRef < boolean > ( false ) ;
375376 const channelResyncScrollSet = useRef < boolean > ( true ) ;
376377
@@ -655,23 +656,23 @@ const MessageListWithContext = <
655656 ) ;
656657 } ;
657658
658- //
659- // We are keeping full control on message pagination, and not relying on react-native for it.
660- // The reasons being,
661- // 1. FlatList doesn't support onStartReached prop
662- // 2. `onEndReached` function prop available on react-native, gets executed
663- // once per content length (and thats actually a nice optimization strategy).
664- // But it also means, we always need to prioritize onEndReached above our
665- // logic for `onStartReached`.
666- // 3. `onEndReachedThreshold` prop decides - at which scroll position to call `onEndReached`.
667- // Its a factor of content length (which is necessary for "real" infinite scroll). But on
668- // the other hand, it also makes calls to `onEndReached` (and this `channel.query`) way
669- // too early during scroll, which we don't really need. So we are going to instead
670- // keep some fixed offset distance, to decide when to call `loadMore` or `loadMoreRecent`.
671- //
672- // We are still gonna keep the optimization, which react-native does - only call onEndReached
673- // once per content length.
674- / /
659+ /**
660+ * We are keeping full control on message pagination, and not relying on react-native for it.
661+ * The reasons being,
662+ * 1. FlatList doesn't support onStartReached prop
663+ * 2. `onEndReached` function prop available on react-native, gets executed
664+ * once per content length (and thats actually a nice optimization strategy).
665+ * But it also means, we always need to prioritize onEndReached above our
666+ * logic for `onStartReached`.
667+ * 3. `onEndReachedThreshold` prop decides - at which scroll position to call `onEndReached`.
668+ * Its a factor of content length (which is necessary for "real" infinite scroll). But on
669+ * the other hand, it also makes calls to `onEndReached` (and this `channel.query`) way
670+ * too early during scroll, which we don't really need. So we are going to instead
671+ * keep some fixed offset distance, to decide when to call `loadMore` or `loadMoreRecent`.
672+ *
673+ * We are still gonna keep the optimization, which react-native does - only call onEndReached
674+ * once per content length.
675+ * /
675676
676677 /**
677678 * 1. Makes a call to `loadMoreRecent` function, which queries more recent messages.
0 commit comments