@tamagui/react-native-web-lite
Version:
React Native for Web
66 lines (65 loc) • 2.29 kB
JavaScript
import { VirtualizedSectionList } from "../VirtualizedSectionList";
import * as React from "react";
import { jsx } from "react/jsx-runtime";
class SectionList extends React.PureComponent {
scrollToLocation(params) {
this._wrapperListRef != null && this._wrapperListRef.scrollToLocation(params);
}
recordInteraction() {
const listRef = this._wrapperListRef && this._wrapperListRef.getListRef();
listRef && listRef.recordInteraction();
}
flashScrollIndicators() {
const listRef = this._wrapperListRef && this._wrapperListRef.getListRef();
listRef && listRef.flashScrollIndicators();
}
getScrollResponder() {
const listRef = this._wrapperListRef && this._wrapperListRef.getListRef();
if (listRef)
return listRef.getScrollResponder();
}
getScrollableNode() {
const listRef = this._wrapperListRef && this._wrapperListRef.getListRef();
if (listRef)
return listRef.getScrollableNode();
}
setNativeProps(props) {
const listRef = this._wrapperListRef && this._wrapperListRef.getListRef();
listRef && listRef.setNativeProps(props);
}
render() {
const { sections, ...passThroughProps } = this.props;
return /* @__PURE__ */ jsx(
VirtualizedSectionList,
{
...passThroughProps,
sections,
ref: this._captureRef,
getItem: this._getItem,
getItemCount: this._getItemCount,
keyExtractor: this._keyExtractor,
renderItem: this._renderItem
}
);
}
_captureRef = (ref) => {
this._wrapperListRef = ref;
};
_getItem = (sections, index) => {
if (!sections)
return null;
const section = sections[index];
return section && section.data ? section.data[0] : null;
};
_getItemCount = (sections) => sections ? sections.length : 0;
_keyExtractor = (item, index) => (this.props.keyExtractor || this._defaultKeyExtractor)(item, index);
_defaultKeyExtractor = (item, index) => item.key != null ? item.key : String(index);
_renderItem = ({ item, index, section }) => (this.props.renderItem || this._defaultRenderItem)({ item, index, section });
_defaultRenderItem = ({ item }) => null;
}
var SectionList_default = SectionList;
export {
SectionList,
SectionList_default as default
};
//# sourceMappingURL=index.js.map