Skip to content

ListView items lose their height after scrolling #7493

@webleaf

Description

@webleaf

Environment
✔ Component nativescript has 5.4.2 version and is up to date.
✔ Component tns-core-modules has 5.4.3 version and is up to date.
✔ Component tns-android has 5.4.0 version and is up to date.
✔ Component tns-ios has 5.4.2 version and is up to date.

Describe the bug
I create ListView (and itemTemplate) dynamically. When I try to specify height via css for itemTemplate, items lose their height after scrolling. After changing css file and after hot reload, styles don't applies to ListView items. Setting property height programmatically don't work at all.
All this about Android. Seem like on iOS all works as expected.

image

To Reproduce
Just copy paste below code to your app.css and app.ts correspondingly.

/* app.css */

label {
    height: 100;
}
/* app.ts */

import * as app from "tns-core-modules/application";
import {ListView} from "tns-core-modules/ui/list-view";
import {View} from "tns-core-modules/ui/core/view";
import {Label} from "tns-core-modules/ui/label";

app.run({
    create: () => {
        const listview = new ListView();
        listview.items = new Array(50);
        listview.itemTemplate = function(): View {
            const label = new Label();
            label.text = "some text";
            // label.height = 60; <--- it's does not affect height on Android at all. But seems work on iOS
            return label
        };
        return listview
    }
});

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions