xamarin/Xamarin.Forms

[Bug] Label LineBreakMode not working

Aperta

#7796 aperta il 3 ott 2019

 (3 commenti) (0 reazioni) (0 assegnatari)C# (1926 fork)batch import
Android10e/2 :clock2:help wantedt/bug :bug:up-for-grabs

Metriche repository

Star
 (5644 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Description

Label LineBreakMode set to 'WordWrap' isn't working has expected, both for iOS and Android platforms. Words are spaned into multiple lines without hyphenation.

As it can be seen in the following image, the word "communication" is broken;

labelissue labelIssueIos

  • Version with issue: 4.2.0.709249
  • Affected Devices: It seems to be happening accross al iOS devices and on Android from API 21 to API27 (AP28 is ok, it uses hyphenization)

Reproduction Link

Here is a simple repo with a Shell navigation to a page with a single label. Play arround with the label left/right Margin to force the words to be in a break situation and observe the behavior. LabelIssue.zip

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="LabelIssue.Views.LabelPage">
    <ContentPage.Content>
        <StackLayout>
            <Label 
                Margin="20,0"
                VerticalOptions="CenterAndExpand"
                HorizontalOptions="FillAndExpand"
                HorizontalTextAlignment="Center"
                Text="Either there aren't any contents to display for now or a communication error occurred."
                LineBreakMode="WordWrap"
                FontSize="Small"
                />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

Guida contributor