The detent term comes from Apple HIG's Sheets docs.
By setting detent to 'content-height' the sheet height will be dynamic and based on the content of the sheet. The sheet height cannot exceed the maximum sheet height (that is the default height when using full-height detent).
If snap points are provided when using content-height detent the height of the sheet will limit the available snap points. For example if the snap points are [700, 100, 0] and the sheet's height is 600 the user cannot snap to 700 since that would cause the sheet to be detached from the bottom. However if the sheet's height dynamically changes to 700 (or larger → scrollable) then the user can snap to the last snap point without issues since the content height is not restricting it anymore.
I also took the opportunity to refactor and clean up the codebase a bit.
@Temzasse replaying here instead of #83 - this is perfect. Thanks for all the work you do on this lib, helped us and clearly is helping a lot of people.
Continuation of https://github.com/Temzasse/react-modal-sheet/pull/83.
This implementation introduces a new prop called:
By setting
detent
to'content-height'
the sheet height will be dynamic and based on the content of the sheet. The sheet height cannot exceed the maximum sheet height (that is the default height when usingfull-height
detent).If snap points are provided when using
content-height
detent the height of the sheet will limit the available snap points. For example if the snap points are[700, 100, 0]
and the sheet's height is 600 the user cannot snap to 700 since that would cause the sheet to be detached from the bottom. However if the sheet's height dynamically changes to 700 (or larger → scrollable) then the user can snap to the last snap point without issues since the content height is not restricting it anymore.I also took the opportunity to refactor and clean up the codebase a bit.