Skip to content

Placeholder with an id attribute doesn't call creatingView handler #772

@KristinaKoeva

Description

@KristinaKoeva

I have the following main-page.xml

<Page xmlns="http://www.nativescript.org/tns.xsd" loaded="pageLoaded">
  <StackLayout>
    <Placeholder id="chartView" creatingView="creatingView"  />
  </StackLayout>
</Page>

and the following main-page.js

var vmModule = require("./main-view-model");
function pageLoaded(args) {
    var page = args.object;
    page.bindingContext = vmModule.mainViewModel;
}

function creatingView(args) {
    console.log("creatingView is called");

    var nativeView = new UILabel();
    nativeView.text = "Native";
    args.view = nativeView;
}

exports.creatingView = creatingView;
exports.pageLoaded = pageLoaded;

When the id attribute is before the creatingView the handler is never called. If I switch them like that
<Placeholder creatingView="creatingView" id="chartView" /> the handler is called.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions