← 输入框|github.com|刷新
Skip to content

Label in FlexboxLayout isn't sized correctly on iOS #4834

Closed
NativeScript/tns-core-modules-widgets
#121

Description

@3rror404

Bit of a strange one.

<FlexboxLayout class="">
    <Image src="/?u=https%3A%2F%2Fplacehold.it%2F40x40" />
    <Label textWrap="true" text="a b c d e f g h i j k l m n o p q r s t u v w x" />
</FlexboxLayout>

<FlexboxLayout class="">
    <Image src="/?u=https%3A%2F%2Fplacehold.it%2F40x40" />
    <Label textWrap="true" text="a b c d e f g h i j k l m n o p q r s t u v w x y z 1" />
</FlexboxLayout>

The markup above produces this layout on iOS:

simulator-screen-shot-12-sep-2017 -17 42 11

As you can see the first Label is cut off after "v". Add a couple more characters to the string and the Label wraps properly and the full string is displayed.

This was in the iPhone 7 simulator. Other screen sizes will work/break with different string lengths.

I have a demo project here showing the issue: https://github.com/3rror404/ns-flexbox-issue

┌──────────────────┬─────────────────┬────────────────┬─────────────┐
│ Component        │ Current version │ Latest version │ Information │
│ nativescript     │ 3.2.0           │ 3.2.0          │ Up to date  │
│ tns-core-modules │ 3.2.0           │ 3.2.0          │ Up to date  │
│ tns-android      │ 3.2.0           │ 3.2.0          │ Up to date  │
│ tns-ios          │ 3.2.0           │ 3.2.0          │ Up to date  │
└──────────────────┴─────────────────┴────────────────┴─────────────┘

Activity

  1. tsonevn commented on Sep 18, 2017

    @tsonevn
    Contributor

    Hi @3rror404,
    Thank you for the sample project.
    I reviewed this case on my side and indeed there is a problem with the setting the correct dimensions for the Flexbox Layout, I was able to reproduce this case on iPhone 7 simulator as well as on Android device. We will investigate further this case and will provide additional info on it. The attached sample project is also tested with @next modules.
    In the meantime, I would suggest using GridLayout as the main container. For example:

    <Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo" class="page">
    
        <Page.actionBar>
            <ActionBar title="My App" icon="" class="action-bar">
            </ActionBar>
        </Page.actionBar>
    
        <GridLayout rows="100 100" class="p-20">
    
            <FlexboxLayout rpw="0" class="">
                <Image src="/?u=https%3A%2F%2Fplacehold.it%2F40x40" />
                <Label textWrap="true" text="a b c d e f g h i j k l m n o p q r s t u v w x" />
            </FlexboxLayout>
    
            <FlexboxLayout row="1" class="">
                <Image src="/?u=https%3A%2F%2Fplacehold.it%2F40x40" />
                <Label textWrap="true" text="a b c d e f g h i j k l m n o p q r s t u v w x y z 1" />
            </FlexboxLayout>
    
        </GridLayout>
    </Page>
    
    
  2. added
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    on Feb 21, 2018
  3. added this to the 4.1 milestone on Apr 16, 2018
  4. removed
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    on Apr 16, 2018
  5. self-assigned this
    on Apr 26, 2018
  6. ghost removed on May 8, 2018
  7. lock commented on Oct 2, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  8. locked and limited conversation to collaborators on Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions