flash-section-list
Version:
SectionList base on FlashList
24 lines (23 loc) • 590 B
JavaScript
export default class LayoutManager {
constructor({
horizontal,
accuracy = 2
}) {
this.horizontal = horizontal;
this.accuracy = accuracy;
}
getSize(layout) {
return this.horizontal ? layout?.width : layout?.height;
}
isChanged(a, b) {
const sizeA = this.getSize(a);
const sizeB = this.getSize(b);
if (sizeA === undefined || sizeB === undefined) return true;
return Math.abs(sizeA - sizeB) > this.accuracy;
}
getSizeProperty() {
return this.horizontal ? 'width' : 'height';
}
}
//# sourceMappingURL=LayoutManager.js.map
;