Skip to content

RN 0.61.5 ScrollView 调用 scrollTo 方法报错: MJScrollViewManager.zoomToRect was called with 4 arguments but expects 3 arguments.  #53

Open
@bigggge

Description

@bigggge

RN 0.61.5 使用 MJScrollView 时,调用 scrollTo scrollToOffset 等方法时报错
RN 0.59.10 使用 MJScrollView 正常
RN 0.61.5 使用自带的 ScrollView 正常

"MJScrollViewManager.zoomToRect was called with 4 arguments but expects 3 arguments. If you haven't changed this method yourself, this usually means that your versions of the native code and JavaScript code are out of sync. Updating both should make this error go away."

通过修改 react-native/Libraries/Components/ScrollResponder.js

    UIManager.dispatchViewManagerCommand(
      nullthrows(this.scrollResponderGetScrollableNode()),
      UIManager.getViewManagerConfig('RCTScrollView').Commands.scrollTo,
      [x || 0, y || 0, animated !== false],
    );

发现方法调用错乱
调 scrollTo 会执行 zoomToRect
调 scrollToEnd 会执行 flashScrollIndicators
调 flashScrollIndicators 会执行 scrollToEnd

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