-
Notifications
You must be signed in to change notification settings - Fork 5
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
Scrollable modals #205
Scrollable modals #205
Conversation
padding-top: 10px; | ||
padding-bottom: 10px; | ||
` | ||
const getDefaultProps = ({ verticalGap, contentContainerStyle }: ModalContentProps) => ({ |
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.
Nit: the contentContainerStyle
properties isn't used in this file (only verticalGap? is passed to
getDefaultProps`). You wanted to keep it for potential future use?
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.
Updated! 😅
A couple of things I'm noticing:
Other than this it works well. One last suggestion: we could maybe stop using |
Fixed ✅
Fixed ✅
Fixed ✅
Done ✅
This bug already exists in the base branch (you can test it by setting a This is the code of handling the layout change of the modal: Gesture.Pan()
.onStart((e) => {
offsetY.value = modalHeight.value
})
.onChange((e) => {
if (position.value !== 'closing') {
modalHeight.value = offsetY.value + e.translationY
}
})
.onEnd(() => {
const shouldMinimise = position.value === 'maximised' && -modalHeight.value < dimensions.height - DRAG_BUFFER
const shouldMaximise =
canMaximize.value && position.value === 'minimised' && -modalHeight.value > minHeight.value + DRAG_BUFFER
const shouldClose =
['minimised', 'closing'].includes(position.value) && -modalHeight.value < minHeight.value - DRAG_BUFFER
if (shouldMaximise) {
handleMaximize()
} else if (shouldMinimise) {
scrollableContent ? handleClose() : handleMinimize()
} else if (shouldClose) {
handleClose()
} else {
modalHeight.value =
position.value === 'maximised'
? withSpring(-maxHeight, springConfig)
: withSpring(-minHeight.value, springConfig)
}
}), When the user lifts their finger the Since this is not introduced in this PR, would you mind tackling it in a follow-up? |
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.
That's perfect. Let's merge this!
ModalContent
is now an instance ofScrollView
(from gesture handler)ModalFlatListContent
can be used instead ofModalContent
for rendering modals that include aFlatList
(also from gesture handler)maximisedContent
or thecustomMinHeight
prop is set, theBottomModal
will take the height of its contents.This doesn't work well for minimized modals. Needs investigation.It does!