Skip to content

fix: android auto responsive sheet size #193

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lovegaoshi
Copy link

this PR implements the strategy mentioned in #192 (comment) to auto adjust bottom sheet height on content height change. I replaced when the only size is "auto"'s bottomsheetbehavior to COLLAPSED instead of EXPANDED, so its height can be adjusted after the sheet is shown.

test is done using a custom component in my app instead of the test code mentioned in the above PR/linked issue, but the idea is the same.

Screen.Recording.2025-07-01.204012.mp4

Copy link

vercel bot commented Jul 2, 2025

@lovegaoshi is attempting to deploy a commit to the Jovanni's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

codeclimate bot commented Jul 2, 2025

Code Climate has analyzed commit 4f93ae4 and detected 4 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 2
Duplication 2

View more on Code Climate.

@lodev09
Copy link
Owner

lodev09 commented Jul 2, 2025

Thanks @lovegaoshi. I'll test over the weekend.

@lodev09
Copy link
Owner

lodev09 commented Jul 6, 2025

@lovegaoshi tested and works. however, it is now draggable to full screen height. Can we disable that and have it draggable up until specified max height?

@lovegaoshi
Copy link
Author

I dont know if that is technically feasible - that requires changing maxHeight which per documentation should only be specified when the sheet is closed. Perhaps there are hacks that either

  • disable bottomsheet.behavior.EXPANDED
  • or combine this with the setMaxHeight approach from Make android sheet reactive to height changes #192 on content size change hoping as bottomsheet.behavior is still in COLLAPSED it wont trigger layout changes.
    but anyways i suspect hacks will be involved.

@lodev09
Copy link
Owner

lodev09 commented Jul 7, 2025

Yeah, try 2nd option. It might be advised to only set maxHeight when closed due for UX purposes since it can't be animated (bad UI for the user). Since we don't get any error so I guess it's kinda "ok" 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants