Skip to content

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

@std4453

Description

@std4453

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions