Tabris.js 1.4 is here

November 3, 2015 | 2 min Read

Tabris.js 1.4 is out now! In this release we focused on adding further enhancements to the CollectionView. You can now implement endless scrolling and other neat effects in pure JavaScript. Read on for the details.

Scroll event for CollectionView

Just like in ScrollView, CollectionView now has a scroll event that lets you know when the user has scrolled. The callback contains information about the scrolling direction and distance.

Determine visible items in CollectionView

The new properties firstVisibleIndex and lastVisibleIndex allow you to determine which items are currently visible on screen. They also come with matching change events, which are very well suited to implement an “endless scrolling list”. Simply listen to change:lastVisibleIndex and start loading more items once the value exceeds a limit of your choosing.

Combining the scroll event with the firstVisibleIndex property, we can create a nice “scrolling section header” effect as shown above. This is achieved in pure JavaScript and works on Android and iOS.

Support for any data type in the Picker items array

Where the Picker previously only accepted an array of strings, it can now deal with any kind of items. This is especially convenient when handling an item in the select and change:selection events.

The display text for an item is extracted using a function that is stored in the property itemText. By default the Picker calls toString() on the item to convert it to a string, but you can also provide a custom function, e.g.:

tabris.create("Picker", {
  items: airports,
  itemText: function(airport) {
    return airport.name;
  }
});

Reduce app install file size on Android

For this release we have also managed to significantly optimize install file sizes on Android by repackaging J2V8. We now only bundle the J2V8 library once for each supported architecture (ARM and x86). These bundled artifacts are used for 32 and 64 bit processors respectively. As a result, install file sizes of apps have reduced by 30-40%!

For the full list of issues closed in 1.4, see here.

If you don’t have the Developer Apps yet, download them now:

[

Also, feel free to leave your feature requests on our GitHub issue tracker. Happy developing with Tabris.js!