Skip to content

Releases: centrevilletech/Ti.Scrollwatch

Ti.Scrollwatch 1.0.0

Choose a tag to compare

@joshualambert joshualambert released this 13 Aug 22:11

Continuous scroll position for Titanium's Android ListView and TableView.

Titanium reports Android list scroll position only when a gesture starts and when it settles — nothing while the list is actually moving. Anything that has to track the list as it scrolls (sticky section headers, collapsing toolbars, early paging) has nothing to work with. This module attaches a real RecyclerView.OnScrollListener and forwards the visible range to JavaScript whenever it changes, so the position you get is the platform's own answer rather than an estimate.

Install

Unzip the attached archive into your project root (it contains modules/), then add to tiapp.xml:

<modules>
    <module platform="android">ti.scrollwatch</module>
</modules>

Requires Titanium SDK 13.0.0.GA or later.

Usage

const scrollwatch = require('ti.scrollwatch');

scrollwatch.watch($.myListView, function (e) {
    Ti.API.info('top row is ' + e.firstVisiblePosition);
});

See the README for mapping flat positions back to sections — Titanium's Android ListView gives section headers no adapter row of their own, which is the detail that trips up most sticky-header implementations.

This release

  • watch() / unwatch() / isReady()
  • Reports firstVisiblePosition, lastVisiblePosition, firstCompletelyVisiblePosition, dx, dy
  • Fires only when the visible range changes, not on every frame of a fling
  • Binaries linked 16 KB page-size aligned for Android 15+ and GrapheneOS
  • arm64-v8a, armeabi-v7a, x86, x86_64