Open hsuehic opened 6 years ago
我在做一个IM 聊天界面的时候,希望初始化和有消息更新的时候,列表的滚动条都可以滚动到底部。
scrollToCurrent() { const self = this setTimeout(() => { if (self.listView) { const { listviewRef } = self.listView if (listviewRef) { const scrollProperties = listviewRef.ListViewRef.getMetrics() if (scrollProperties) { const { contentLength, visibleLength } = scrollProperties if (contentLength && visibleLength) { const offset = contentLength - visibleLength if (offset > 0) { listviewRef.scrollTo(0, offset) } } } } } }) }
使用以上的代码,拿到的 contentLength不是正确。
能否新增加个属性,让列表从后面的行开始渲染, 然后滚动到底部,下拉时渲染前面的记录?
我在做一个IM 聊天界面的时候,希望初始化和有消息更新的时候,列表的滚动条都可以滚动到底部。
使用以上的代码,拿到的 contentLength不是正确。