-
Notifications
You must be signed in to change notification settings - Fork 1.9k
GH-3106 Implemented LineBreakMode to Button #7810
Conversation
- Added LineBreakMode in ButtonRenderer
- Fixed button height update in Material iOS Button; - Code style fix on UWP
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.
@pictos Thanks for the PR.
Is the Android implementation missing? You could use https://github.com/xamarin/Xamarin.Forms/blob/9494ed5006040355edd41a5fa392fbc397f94d95/Xamarin.Forms.Platform.Android/Extensions/TextViewExtensions.cs
Could you add the property in Button Core Gallery https://github.com/xamarin/Xamarin.Forms/blob/9494ed5006040355edd41a5fa392fbc397f94d95/Xamarin.Forms.Controls/CoreGalleryPages/ButtonCoreGalleryPage.cs (and/or a sample Issue3106.cs
?
{ | ||
internal static class TextBlockExtensions | ||
{ | ||
public static void UpdateLineBreakMode(this TextBlock textBlock, LineBreakMode lineBreakMode) |
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.
👍
@jsuarezruiz I'll send the Android implementation later in this PR. |
I realized that |
Mnn, better separate in another PR to facilitate traceability and history. |
@@ -33,9 +33,9 @@ static void SetMaxLines(this TextView textView, Label label, int lines) | |||
textView.SetMaxLines(lines); | |||
} | |||
|
|||
public static void SetLineBreakMode(this TextView textView, Label label) | |||
public static void SetLineBreakMode(this TextView textView, Label label, Button button = null) |
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.
ABI breaking change
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.
@samhouts even with button
being null by default is an API breaking change?
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.
Well, it's technically not a breaking change yet, but an optional parameter here feels a bit strange. I think I'd rather see two methods here with some code duplication or some refactoring to call a third common method.
@pictos Sure, let me check the code to see what may be happening. What platform does it happen (Android or iOS)?. Is it something that always happens?. (This screenshot is using CharacterWrap). |
@jsuarezruiz this occurs when you load the page, as you can see in the gif. |
@jsuarezruiz any thoughts? |
@jsuarezruiz any update on this? |
This comment has been minimized.
This comment has been minimized.
return; | ||
|
||
view.SetLineBreakMode(_element); | ||
view.SetAllCaps(true); |
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.
??
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.
@samhouts, sorry I didn't understand
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.
Are we supposed to be forcing AllCaps here? I didn't see this in the original version.
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.
@samhouts, I'm sorry for the late reply... Well if we don't use that, the text in the button will not follow the actual behavior for text in the Android's button and text will not be all caps.
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.
@pictos What causes it to not be all caps anymore?
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.
@samhouts I don't know why that is, but I can try to find out (if it's needed). Just to exemplify, if I remove this line, the result is:
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.
@pictos I think it's work investigating why that is different. Thanks!
Co-Authored-By: Samantha Houts <samhouts@users.noreply.github.com>
Co-Authored-By: Samantha Houts <samhouts@users.noreply.github.com>
Co-Authored-By: Samantha Houts <samhouts@users.noreply.github.com>
Ping - thanks a lot, this will be extremely helpful |
I will close this one because it this very old, I created the #11147 |
Description of Change
Added the LineBreakMode to Button.
Issues Resolved
API Changes
Added:
Platforms Affected
Behavioral/Visual Changes
Now users can set a line break mode to texts on Button, the default value doesn't affect any user.
None
Before/After Screenshots
PR Checklist