Thanks to visit codestin.com
Credit goes to github.com

Skip to content

core 8.2.0-alpha.1+ : Binding: Run-time error occured in file: undefined at line: undefined and column: undefined #9785

Closed
@felixkrautschuk

Description

@felixkrautschuk

Issue Description

When installing @nativescript/core 8.2.0-alpha.1 and newer (also latest 8.2.0-alpha.9), I see many binding errors in the console in Android and iOS.

CONSOLE ERROR: Binding: Run-time error occured in file: undefined at line: undefined and column: undefined

Mostly it happens when using nested bindings. Some of the occurencies of this error I am not able to explain or to reproduce, but at least I can reproduce it in one scenari with RadListView.

Let's assume this layout in XML:

<lv:RadListView items="{{ items }}">
        <lv:RadListView.itemTemplate>
            <StackLayout padding="15">
                <Label text="{{ 'id: ' + id }}"/>
                <Label text="{{ 'name: ' + name }}"/>
                <Label text="{{ authorInfo.name, 'author name: ' + authorInfo.name }}"/>     <!-- is causing the error message -->
            </StackLayout>
        </lv:RadListView.itemTemplate>
</lv:RadListView>

And I have this binding context of the page:
(just some dummy data...)

export const vm = fromObject({
  items: new ObservableArray([
    { id: 1, name: "Item 1", authorInfo: { id: 999, name: "Firstname Lastname"} },
    { id: 2, name: "Item 2", authorInfo: { id: 999, name: "Firstname Lastname"} },
    { id: 3, name: "Item 3", authorInfo: { id: 999, name: "Firstname Lastname"} },
    ...
  ])
});

then I see this error message when initially loading the page and when scrolling the list.

The error message is caused by this:
<Label text="{{ authorInfo.name, 'author name: ' + authorInfo.name }}"/>

When removing the static string in that Label's text and do something like this:
<Label text="{{ authorInfo.name }}"/>
then the error message does not appear.

Note that this issue does NOT happen at all with @nativescript/core 8.2.0-alpha.0, only on newer versions.

Reproduction

Get the demo app:
ns-binding-issue.zip

Run it -> you will see the error messages in the console.

Relevant log output (if applicable)

CONSOLE ERROR: Binding: Run-time error occured in file: undefined at line: undefined and column: undefined

Environment

not able to run that command for an unknown reason, so here is my package.json content instead:

{
"name": "ns-binding-issue",
"main": "app/app.ts",
"version": "1.0.0",
"private": true,
"dependencies": {
"@nativescript/core": "^8.2.0-alpha.9",
"nativescript-ui-listview": "^10.0.2"
},
"devDependencies": {
"@nativescript/android": "^8.2.0-alpha.11",
"@nativescript/ios": "^8.2.0-alpha.6",
"@nativescript/types": "~8.1.1",
"@nativescript/webpack": "~5.0.0",
"typescript": "~4.3.5"
}
}

Please accept these terms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions