eclipsesource / eclipsesource/tabris-js

collectionView reveal function is inconsistent between platforms

Open
#865 1 comment 0 reactions 0 assignees View on GitHub
api feature
Dominant language
JavaScript
Stars
1.4k
Forks
171
PR merge metrics
No merged PRs in 30d

Description

In the example a new item is added every 3 seconds.
- On iOS there is an animated scroll to the new position.
- On Android it is instant.

The api should preferably allow both behaviours (animated and instant).

Run this snippet:

```
var arr = [];
var index =1;
function generateItem(){
return {firstName: "Cell: "+ index++, background: (index%2)? 'red':'blue'}
}
for (var i =0; i< 50; i++){
arr.push( generateItem() );
}

var page = new tabris.Page({
title: "Collection View",
topLevel: true
});

var collection = new tabris.CollectionView({
layoutData: {left: 0, top: 0, right: 0, bottom: 0},
items: arr,
itemHeight: 60,
initializeCell: function(cell) {

var nameTextView = new tabris.TextView({
layoutData: {left: 30, top: ["prev()", 16], right: 30},
font: '30px bold',
alignment: "center",
}).appendTo(cell);
cell.on("change:item", function(widget, data) {
nameTextView.set({
text: data.firstName,
background: data.background,
});
});
}
}).appendTo(page);

setInterval(function(){
var newItems = collection.get("items").concat([generateItem()]);
collection.set("items", newItems);
collection.reveal(newItems.length-1);
},3000);

page.open();
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.