Skip to content

RadListView iOS: items are loaded twice (watching the itemLoading-event) #1299

Open
@felixkrautschuk

Description

@felixkrautschuk

Tell us about the problem

When loading some data from the server and pushing the data to the DataSouce of the RadListView, the items seem to be loaded twice on iOS.

This is the bindingContext of the page:

    items: new observableArrayModule.ObservableArray(),

    loadData: function() {
        var self = this;

        return new Promise(function (resolve, reject) {
            http.getJSON("https://restcountries.eu/rest/v2/all").then(function(response) {
                self.get('items').splice(0);
                self.get('items').push(response);

                resolve();
            }, function (e) {
                console.log(e);
                reject();
            });
        });
    }

I trigger the itemLoading event of the RadListView this way:

exports.onItemLoading = function(args) {
    console.log("itemLoadingEvent index " + args.index);
};

And this creates the following output on iOS:

CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 0
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 1
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 2
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 3
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 4
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 5
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 6
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 7
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 8
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 9
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 10
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 11
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 12
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 13
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 14
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 15
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 0
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 1
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 2
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 3
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 4
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 5
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 6
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 7
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 8
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 9
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 10
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 11
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 12
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 13
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 14
CONSOLE LOG file:///app/main-page.js:33:0: itemLoadingEvent index 15

... so you see it is loading the items twice.
On Android, the output is as expected (items are loaded only once).

The same issue occurs when using pulltorefresh. You also can feel it on a physical device (e.g. iPhone 6) that the data needs more time to be actually displayed, compared to Android.

Which platform(s) does your issue occur on?

iOS

Please provide the following version numbers that your issue occurs with:

  • Progress NativeScript UI plugin version: 7.1.0
  • CLI: 6.1.2
  • Cross-platform modules: 6.1.2
  • Runtime(s): tns-ios 6.1.1, tns-android 6.1.2

Please tell us how to recreate the issue in as much detail as possible.

  1. Start the application ..
  2. ...

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

RlvPullToRefreshIssueIOS.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions