Skip to content

Commit

Permalink
fix(android): tableView optimizations (#13768)
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga committed Mar 12, 2023
1 parent 9ee0d42 commit 57bcbf9
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -342,7 +342,10 @@ public KrollDict generateScrollPayload()
final TableViewHolder firstVisibleHolder =
(TableViewHolder) recyclerView.getChildViewHolder(firstVisibleView);
final TableViewRowProxy firstVisibleProxy = (TableViewRowProxy) firstVisibleHolder.getProxy();
final int firstVisibleIndex = firstVisibleProxy.getIndexInSection();
int firstVisibleIndex = -1;
if (firstVisibleProxy != null) {
firstVisibleIndex = firstVisibleProxy.getIndexInSection();
}
payload.put(TiC.PROPERTY_FIRST_VISIBLE_ITEM, firstVisibleIndex);
}

Expand Down Expand Up @@ -746,7 +749,12 @@ public void run()
}

// Notify adapter of changes on UI thread.
this.adapter.update(this.rows, force);
recyclerView.post(new Runnable() {
public void run()
{
adapter.update(rows, force);
}
});

// FIXME: This is not an ideal workaround for an issue where recycled items that were in focus
// lose their focus when the data set changes. There are improvements to be made here.
Expand Down

0 comments on commit 57bcbf9

Please sign in to comment.