Repository navigation
feat(ios): -ios-corner-shape alias for the continuous corner curve #11453
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1053,17 +1053,35 @@ export const borderBottomLeftRadiusProperty = new CssProperty<Style, CoreTypes.L | |
| }); | ||
| borderBottomLeftRadiusProperty.register(Style); | ||
|
|
||
| export const cornerShapeProperty = new CssProperty<Style, CoreTypes.CornerShapeType>({ | ||
| export const cornerShapeProperty = new CssProperty<Style, CoreTypes.IOSCornerShapeType>({ | ||
| name: 'cornerShape', | ||
| cssName: 'corner-shape', | ||
| defaultValue: CoreTypes.CornerShape.round, | ||
| valueConverter: CoreTypes.CornerShape.parse, | ||
| // Only CALayer can draw `continuous`; other platforms keep the spec grammar. | ||
| valueConverter: (value) => (__APPLE__ ? CoreTypes.IOSCornerShape.parse(value) : CoreTypes.CornerShape.parse(value)), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Either (a) accept |
||
| valueChanged: (target, oldValue, newValue) => { | ||
| target.backgroundInternal = target.backgroundInternal.withCornerShape(newValue); | ||
| }, | ||
| }); | ||
| cornerShapeProperty.register(Style); | ||
|
|
||
| export const iosCornerShapeProperty = new ShorthandProperty<Style, CoreTypes.IOSCornerShapeType>({ | ||
| name: 'iosCornerShape', | ||
| cssName: '-ios-corner-shape', | ||
| getter: function (this: Style) { | ||
| return this.cornerShape; | ||
| }, | ||
| // Alias of corner-shape: cascades in its place on Apple, dropped elsewhere. | ||
| converter: function (value) { | ||
| if (!__APPLE__) { | ||
| return []; | ||
| } | ||
|
|
||
| return [[cornerShapeProperty, typeof value === 'string' ? CoreTypes.IOSCornerShape.parse(value) : value]]; | ||
| }, | ||
| }); | ||
| iosCornerShapeProperty.register(Style); | ||
|
|
||
| const boxShadowProperty = new CssProperty<Style, ShadowCSSValues[]>({ | ||
| name: 'boxShadow', | ||
| cssName: 'box-shadow', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,10 +154,19 @@ export class Style extends Observable { | |
|
|
||
| /** | ||
| * The curve used to round the corners: 'round' (circular arcs, the default) | ||
| * or 'squircle' (Apple's continuous corner curve). iOS only; Android always | ||
| * renders circular corners. | ||
| * or 'squircle' (the CSS superellipse). On Apple platforms it also accepts | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Until #11451 lands, squircle isn't "the CSS superellipse" yet (it renders circular through the mask). Another reason to land the two together. |
||
| * 'continuous' (Apple's continuous corner curve), normally set through | ||
| * iosCornerShape. Android always renders circular corners. | ||
| */ | ||
| public cornerShape: CoreTypes.CornerShapeType; | ||
| public cornerShape: CoreTypes.IOSCornerShapeType; | ||
|
|
||
| /** | ||
| * Apple-only alias of cornerShape (`-ios-corner-shape` in CSS). It cascades | ||
| * in place of cornerShape on Apple platforms and is ignored elsewhere, so | ||
| * `corner-shape: squircle; -ios-corner-shape: continuous;` renders the | ||
| * continuous curve on iOS and the squircle on Android. | ||
| */ | ||
| public iosCornerShape: CoreTypes.IOSCornerShapeType; | ||
|
|
||
| public boxShadow: string | ShadowCSSValues[]; | ||
|
|
||
|
|
||
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.
This returns false for any squircle even with no radius. With
corner-shape: squircle, a uniformborder-widthand radius 0, the border goes down the shape-layer path sized at draw time, but_onSizeChanged(core/view/index.ios.ts) doesn't redraw it since the border is uniform and there's no radius, so it's stale after a resize (text change, rotation, flex). It also adds an unneeded shape layer + scroll listener to every radius-less squircle view, which a theme-widecorner-shape: squirclerule would hit broadly.