RecyclerListView 的过滤数据

Filter data for RecyclerListView

我正在尝试使用 RecyclerListView 实现带有过滤器的基本列表。 但是一旦输入一些文本并且滚动条不在顶部,它就会抛出异常 No layout available for index.

看在这小吃https://snack.expo.io/SJY6NU00B

复制说明:

  1. 滚动到底部
  2. 在 TextInput
  3. 中输入字母 'A'

结果:

No layout available for index: 233 LayoutUnavailableException: No layout available for index: 233 at new e (module://recyclerlistview.js:3:1527) at e.getOffsetForIndex (module://recyclerlistview.js:3:5917) at t.refreshWithAnchor (module://recyclerlistview.js:3:26794) at e._checkAndChangeLayouts (module://recyclerlistview.js:3:16117) at e.componentWillReceiveProps (module://recyclerlistview.js:3:11983) at Hi ([snack internals] at ha ([snack internals] at Js ([snack internals] at js ([snack internals] at Ps (https://s3.us-west-1.amazonaws.com/snack-web-player/36/static/js/2.d51b9d02.chunk.js:1:1086639)

我做错了吗?

在包本身中,我做了以下事情:

注释掉 LayoutManager.js lines: 64-67

中抛出异常的行

而是直接输入 return { x: 0, y: 0};

WrapGridLayoutManager.prototype.getOffsetForIndex = function (index) {
    if (this._layouts.length > index) {
        return { x: this._layouts[index].x, y: this._layouts[index].y };
    }
    else {
        return { x: 0, y: 0};
        // Commented the part that throws exception
        // throw new CustomError_1.default({
        //     message: "No layout available for index: " + index,
        //     type: "LayoutUnavailableException",
        // });
    }
};

我已经打开了这个问题,但它仍然没有得到解决 https://github.com/Flipkart/recyclerlistview/issues/446