xamarin/Xamarin.Forms

[Bug] Label LineBreakMode not working

Aberta

#7.796 aberto em 3 de out. de 2019

 (3 comentários) (0 reação) (0 responsável)C# (1.926 forks)batch import
Android10e/2 :clock2:help wantedt/bug :bug:up-for-grabs

Métricas do repositório

Stars
 (5.644 estrelas)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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>

Guia do colaborador