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

与 ListView 同时使用时没有正确触发重新渲染 #242

Open
std4453 opened this issue Jul 29, 2021 · 0 comments
Open

与 ListView 同时使用时没有正确触发重新渲染 #242

std4453 opened this issue Jul 29, 2021 · 0 comments

Comments

@std4453
Copy link

std4453 commented Jul 29, 2021

ListView 中使用时,传过来的 getScrollContainer 第一次必然得到 undefined,第二次渲染才会使用 ListView 提供的 container,且第二次渲染不会自动触发,在 onTouchMove 等事件产生导致重新渲染时会导致 DOM 结构整体变化,以及 children 被重新创建 / 渲染。

if (getScrollContainer()) {

相关:#171

复现:https://clxjt.csb.app/

workaround:

const MyPullToRefresh = ({ getScrollContainer, ...props }) => (
  <PullToRefresh
    getScrollContainer={() => getScrollContainer?.() || true}
    {...props}
  />
);

由于 getScrollContainerListView 覆盖了,因此只能自己包一个 MyPullToRefresh,保证返回值非 undefined

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

1 participant