Skip to content

Commit

Permalink
fix: scrolling to location for select with sections option (#259)
Browse files Browse the repository at this point in the history
Co-authored-by: Dawid Gierdal <dawid.gierdal@mobilereality.pl>
  • Loading branch information
dawidgierdal and dawidgierdalmr authored Sep 27, 2024
1 parent fff605b commit 622f3bb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/nice-rabbits-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mobile-reality/react-native-select-pro': patch
---

bug fix with scrolling to location for select with sections option
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ export const SectionOptionsList = memo(
const scrollToIndex = () => {
if (sectionOptionsListRef.current) {
try {
sectionOptionsListRef.current.scrollToLocation({
...getSectionLocation({
data: resolvedData,
selectedOption,
scrollToSelectedOption,
}),
animated: false,
const location = getSectionLocation({
data: resolvedData,
selectedOption,
scrollToSelectedOption,
});

if (location.sectionIndex >= 0 && location.itemIndex >= 0) {
sectionOptionsListRef.current.scrollToLocation({
...location,
animated: false,
});
}
} catch {
logError(ERRORS.SCROLL_TO_LOCATION);
}
Expand Down

0 comments on commit 622f3bb

Please sign in to comment.