Skip to content

Instantly share code, notes, and snippets.

@zo0m
Created May 12, 2020 12:23
Show Gist options
  • Save zo0m/c2717085c3f65e20a5344b30f8999acd to your computer and use it in GitHub Desktop.
Save zo0m/c2717085c3f65e20a5344b30f8999acd to your computer and use it in GitHub Desktop.
Appcelerator Titanium Android ListView access via Hyperloop
const ListView = require('android.widget.ListView');
const View = require('android.view.View');
const ViewGroup = require('android.view.ViewGroup');
(function (tiList) {
const listWrapper = new View(tiList);
const nativeListView = ViewGroup.cast(listWrapper).getChildAt(1);
const list = ListView.cast(nativeListView);
list.smoothScrollToPositionFromTop((itemIndex + 1 /* 1st section*/), 0, 100);
setTimeout(function () {
list.setSelectionFromTop((itemIndex + 1 /* 1st section*/), 0);
}, 200);
})($.eventsFeed);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment