ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
50.93k stars 13.52k forks source link

feat: ion-modal sheet, breakpoints with fixed pixels #29827

Closed kumibrr closed 1 week ago

kumibrr commented 1 week ago

Prerequisites

Describe the Feature Request

Implement adding pixel values to the breakpoints array

Describe the Use Case

Components on top of the modal that should never get overflowed would not get hidden on smaller or zoomed viewports

Describe Preferred Solution

[breakpoints]="[300, 0.70, 700 , 1]" would set four breakpoints and sort them by height. Example given a screen with height of 1400px it would be [300, 700, 0.7 = 980px, 1 = 1400px]

Describe Alternatives

No response

Related Code

https://github.com/kumibrr/sheet-modal-example

Additional Information

Here's two screenshots that showcase the current behavior Screenshot 2024-09-03 132102 Screenshot 2024-09-03 132211

sean-perkins commented 1 week ago

Hello @kumibrr the breakpoints are based on the relative height of the modal, not the screen.

The breakpoints to use when creating a sheet modal. Each value in the array must be a decimal between 0 and 1 where 0 indicates the modal is fully closed and 1 indicates the modal is fully open. Values are relative to the height of the modal, not the height of the screen. One of the values in this array must be the value of the initialBreakpoint property. For example: [0, .25, .5, 1]

The team landed on the decimal values between 0 to 1 to offer consistency across devices and a predictable pattern for developers.