-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding pagination to SelectionList component #37627
Adding pagination to SelectionList component #37627
Conversation
@@ -78,6 +80,9 @@ function BaseSelectionList<TItem extends ListItem>( | |||
const isFocused = useIsFocused(); | |||
const [maxToRenderPerBatch, setMaxToRenderPerBatch] = useState(shouldUseDynamicMaxToRenderPerBatch ? 0 : CONST.MAX_TO_RENDER_PER_BATCH.DEFAULT); | |||
const [isInitialSectionListRender, setIsInitialSectionListRender] = useState(true); | |||
const [currentPage, setCurrentPage] = useState(1); | |||
|
|||
const incrementPage = () => setCurrentPage((prev) => prev + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the search text changes, let's not forget to reset the pagination state. We have useEffect
that takes care of resetting the focusedItem on text changes, we'll just have to reset the pagination state too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @lukemorawski Friendly bump.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sorry, you are absolutely right. Will fix that in a mo.
Reviewer Checklist
Screenshots/Videos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@cristipaval looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
All checks were passed when I merged 🤔 |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/cristipaval in version: 1.4.51-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.4.51-3 🚀
|
Details
This PR adds pagination feature to the
SelectionList
component the same way as is in currently deprecatedOptionsSelector
.Fixed Issues
$ #36121
PROPOSAL: no-proposal
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
native.android.mov
Android: mWeb Chrome
web.android.mov
iOS: Native
native.ios.mov
iOS: mWeb Safari
web.ios.mov
MacOS: Chrome / Safari
web.desktop.mov
MacOS: Desktop
native.desktop.mov