Skip to content

CSS not working on Repeater when bindingContext set on 'navigatingTo' #590

Closed

Description

@emiloberg

Easiest described with an example.

Look at this very simple app. It has a Repeater where every item will be a label with the cssClass red, and below them there's a "fixed" label with the text This is always red and the same cssClass.

<Page xmlns="http://www.nativescript.org/tns.xsd" loaded="pageLoaded">
    <StackLayout>
        <Repeater items="{{ items }}">
            <Repeater.itemTemplate>
                <Label text="{{ title }}" cssClass="red" />
            </Repeater.itemTemplate>
        </Repeater>
        <Label text="This is always red" cssClass="red" />
    </StackLayout>
</Page>
function pageLoaded(args) {
    var page = args.object;
    page.bindingContext = {
        items: [
            {
                title: 'Test1'
            },
            {
                title: 'Test2'
            }
        ]
    };
}
exports.pageLoaded = pageLoaded;
.red {
    color: #ff0000;
}

So far so good. However, if I change from setting the bindingContext on loaded to navigatingTo, e.g. changing:

<Page xmlns="http://www.nativescript.org/tns.xsd" loaded="pageLoaded">

to

<Page xmlns="http://www.nativescript.org/tns.xsd" navigatingTo="pageLoaded">

then no CSS will be applied on the itemTemplate of the Repeater. Instead it will look like this. Note that CSS is still applied to the "fixed" label.

skarmavbild 2015-08-14 kl 16 52 06

Activity

  1. self-assigned this
    on Aug 27, 2015
  2. added this to the 1.3.0 milestone on Aug 27, 2015
  3. reopened this on Aug 27, 2015
  4. added
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    and removed
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    on Aug 27, 2015
  5. lock commented on Aug 31, 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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions