Skip to content

Commit 630bd8a

Browse files
authored
fix: suggestions pagination (#3423)
## 🎯 Goal This PR fixes pagination for suggestions (mentions for example) as it was not happening. ## πŸ›  Implementation details <!-- Provide a description of the implementation --> ## 🎨 UI Changes <!-- Add relevant screenshots --> <details> <summary>iOS</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> <details> <summary>Android</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> ## πŸ§ͺ Testing <!-- Explain how this change can be tested (or why it can't be tested) --> ## β˜‘οΈ Checklist - [ ] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required) - [ ] PR targets the `develop` branch - [ ] Documentation is updated - [ ] New code is tested in main example apps, including all possible scenarios - [ ] SampleApp iOS and Android - [ ] Expo iOS and Android
1 parent 69845a4 commit 630bd8a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

β€Žpackage/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsxβ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
useMessageInputContext,
1010
} from '../../contexts/messageInputContext/MessageInputContext';
1111
import { useTheme } from '../../contexts/themeContext/ThemeContext';
12+
import { useStableCallback } from '../../hooks';
1213
import { useStateStore } from '../../hooks/useStateStore';
1314

1415
export const DEFAULT_LIST_HEIGHT = 200;
@@ -82,6 +83,8 @@ export const AutoCompleteSuggestionList = ({
8283
) : null;
8384
}, [AutoCompleteSuggestionHeader, queryText, triggerType]);
8485

86+
const loadMore = useStableCallback(() => suggestions?.searchSource.search());
87+
8588
if (!showList || !triggerType) {
8689
return null;
8790
}
@@ -93,6 +96,8 @@ export const AutoCompleteSuggestionList = ({
9396
keyboardShouldPersistTaps='always'
9497
keyExtractor={(item) => item.id}
9598
ListHeaderComponent={renderHeader}
99+
onEndReached={loadMore}
100+
onEndReachedThreshold={0.1}
96101
renderItem={renderItem}
97102
style={[
98103
styles.flatlist,

0 commit comments

Comments
Β (0)