-
Notifications
You must be signed in to change notification settings - Fork 28
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
Adjust onSettle index of BottomSheet #946
base: master
Are you sure you want to change the base?
Conversation
Published version: @draftbit/[email protected] |
@@ -109,7 +109,7 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>( | |||
borderWidth, | |||
borderColor: borderColor ?? theme.colors.border.brand, | |||
}} | |||
onChange={(index) => onSettle?.(mappedSnapPoints.length - index - 1)} | |||
onChange={(index) => onSettle?.(index)} |
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.
I don't think this is the issue. Looking at the linear issue (and testing on my own), seems the bottom sheet has 4 snap points, even though by default there should only be 3 (top, middle, bottom). I think this inconsistency is what is leading to the incorrect index, but the existing logic for this is still correct.
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.
Seems there's always an additional snap point for some reason, hmm..
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.
I can investigate this later today, but let me know if you have any idea why this could be happening.
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.
Ya, I will investigate more today 🙏 thanks for point out
Overview
Demo
Screen.Recording.2024-08-28.at.18.08.39.mov
Summary:
Updated
BottomSheet
component to use the index directly inonChange
and added logging inBottomSheetExample
.Key points:
onChange
inpackages/core/src/components/BottomSheet/BottomSheet.tsx
to use the index directly.onChange
.onSettle
callback inexample/src/BottomSheetExample.tsx
to log the new index.Generated with ❤️ by ellipsis.dev