Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于消息列表的内存优化建议 #36

Closed
yangfanyu opened this issue Sep 24, 2019 · 2 comments
Closed

关于消息列表的内存优化建议 #36

yangfanyu opened this issue Sep 24, 2019 · 2 comments

Comments

@yangfanyu
Copy link

yangfanyu commented Sep 24, 2019

首先我设置inverted={true},该值为false时载入界面会自动播放N长时间的往下滚动动画(不知是不是bug)
初始载入1000条消息的情况(注意views数量):

WechatIMG8

往上滑动一段距离后,views数量增长了极多,而且不会降下来:

WechatIMG9

另外,长按多选时,消息多了明显卡顿。

--------------分割线---------------------

之后我在源码中flatlist的渲染处加上了removeClippedSubviews={true},初始化载入情况:

101569329614_ pic_hd

往上滑动一段距离后,views数量基本不变:

111569329653_ pic_hd

是否可加上一些flatlist优化参数的配置入口

@DaiYz
Copy link
Owner

DaiYz commented Sep 25, 2019

首先 以最新消息一定是最后一条为原则 当inverted= false ,进入聊天界面,为了能快速到达最新一条消息是有一个滚动到底部的动画,消息多的话肯定会卡顿,你应当考虑在列表超过屏幕的时候,下次在进入聊天界面采用倒排形式即inverted= true

@DaiYz DaiYz added bug Something isn't working and removed bug Something isn't working labels Sep 25, 2019
@DaiYz
Copy link
Owner

DaiYz commented Sep 25, 2019

已加属性flatListProps

@DaiYz DaiYz closed this as completed Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants