xamarin/Xamarin.Forms

[Bug] Label LineBreakMode not working

オープン

#7,796 opened on 2019/10/03

 (3 件のコメント) (0 件のリアクション) (0 人の担当者)C# (1,926 件のフォーク)batch import
Android10e/2 :clock2:help wantedt/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

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>

コントリビューターガイド