Files
discord-decomp/modules/fastest_list/FastestList.ios.tsx
T
2026-11-01 12:12:55 +02:00

68 lines
5.2 KiB
TypeScript

// Metro module 9256 (f9257).
import { forwardRef, useCallback, useMemo } from "react";
import { RefreshControl } from "react-native";
import useFastestListPropsScrollReporting_native from "./props/useFastestListPropsScrollReporting.native";
import useFastestListPropsEstimatedListSize_native from "./props/useFastestListPropsEstimatedListSize.native";
import FastList, { FastListItemTypes, AnimatedFastList } from "../../lib/native/FastList";
import FastestListItemType from "./FastestListItemType";
const noop = () => {};
const r24 = forwardRef(function(a0, a1) {
const { accessibilityLabel, enabled, estimatedListSize, horizontal: _horizontal, inActionSheet, insetStart, insetEnd, itemSize, keyboardDismissMode, keyboardShouldPersistTaps, keyExtractor, listFooterSize, listFooterAlwaysMounted: _listFooterAlwaysMounted, listHeaderSize, listHeaderAlwaysMounted: _listHeaderAlwaysMounted, onLayout, preventNativeModalDismiss, renderAhead: _renderAhead, renderItem, renderListFooter, renderListHeader, renderSectionHeader, renderSectionFooter, scrollEventThrottle, scrollIndicatorInsetEnd, scrollIndicatorInsetStart, sectionHeaderSize, sectionHeaderIsSticky: _sectionHeaderIsSticky, sectionFooterSize, sections, showsHorizontalScrollIndicator, showsVerticalScrollIndicator, style, ...rest } = a0;
a0.enabled;
let horizontal = a0.horizontal;
if (horizontal === void 0) {
horizontal = false;
}
let c17093_0 = horizontal;
let listFooterAlwaysMounted = a0.listFooterAlwaysMounted;
if (listFooterAlwaysMounted === void 0) {
listFooterAlwaysMounted = false;
}
let listHeaderAlwaysMounted = a0.listHeaderAlwaysMounted;
if (listHeaderAlwaysMounted === void 0) {
listHeaderAlwaysMounted = false;
}
const { renderAhead = "nominal", sectionHeaderIsSticky = true } = a0;
const fastestListPropsScrollReporting_native = useFastestListPropsScrollReporting_native(rest, horizontal);
const { onScroll, onScrollBeginDrag, onScrollEndDrag } = fastestListPropsScrollReporting_native;
const fastestListPropsEstimatedListSize_native = useFastestListPropsEstimatedListSize_native({
estimatedListSize,
horizontal
});
const callback = useCallback((a0, a1, a2) => {
if (FastListItemTypes.ITEM === a0) {
return keyExtractor == null ? void 0 : keyExtractor(FastestListItemType.ITEM, a1, a2 == null ? -1 : a2);
}
if (FastListItemTypes.SECTION === a0) {
return keyExtractor == null ? void 0 : keyExtractor(FastestListItemType.SECTION_HEADER, a1, -1);
}
if (FastListItemTypes.SECTION_FOOTER === a0) {
return keyExtractor == null ? void 0 : keyExtractor(FastestListItemType.SECTION_FOOTER, a1, -1);
}
}, [keyExtractor]);
const memo = useMemo(() => scrollIndicatorInsetStart == null ? scrollIndicatorInsetEnd == null ? void 0 : c17093_0 ? {
left: scrollIndicatorInsetStart,
right: scrollIndicatorInsetEnd
} : {
top: scrollIndicatorInsetStart,
bottom: scrollIndicatorInsetEnd
} : c17093_0 ? {
left: scrollIndicatorInsetStart,
right: scrollIndicatorInsetEnd
} : {
top: scrollIndicatorInsetStart,
bottom: scrollIndicatorInsetEnd
}, [horizontal, scrollIndicatorInsetEnd, scrollIndicatorInsetStart]);
const memo2 = useMemo(() => preventNativeModalDismiss === true ? inActionSheet === true ? <RefreshControl refreshing={false} onRefresh={noop} tintColor="transparent" /> : void 0 : void 0, [preventNativeModalDismiss, inActionSheet]);
const Component = rest.scrollReporting === "animatedCallbacks" ? AnimatedFastList : FastList;
const batchesToRender = renderAhead === "nominal" ? void 0 : renderAhead === "half" ? 14 : renderAhead !== "full" ? void 0 : 16;
const stickySectionsVariant = sectionHeaderIsSticky ? "default" : "disabled";
const onScroll2 = rest.scrollReporting !== "animatedScrollPosition" ? onScroll : void 0;
const scrollPosValue = rest.scrollReporting === "animatedScrollPosition" ? rest.scrollPosition : void 0;
if (!listHeaderAlwaysMounted) {
listHeaderAlwaysMounted = listFooterAlwaysMounted;
}
return <Component accessibilityLabel={accessibilityLabel} automaticallyAdjustsScrollIndicatorInsets={memo == null} batchesToRender={batchesToRender} refreshControl={memo2} chunkBase={fastestListPropsEstimatedListSize_native} stickySectionsVariant={stickySectionsVariant} footerSize={listFooterSize} getRecyclerKey={callback} headerSize={listHeaderSize} horizontal={horizontal} inActionSheet={inActionSheet} insetStart={insetStart} insetEnd={insetEnd} itemSize={itemSize} keyboardDismissMode={keyboardDismissMode} keyboardShouldPersistTaps={keyboardShouldPersistTaps} onLayout={onLayout} onScroll={onScroll2} onScrollBeginDrag={onScrollBeginDrag} onScrollEndDrag={onScrollEndDrag} optimizeListItemRender ref={a1} renderItem={renderItem} renderFooter={renderListFooter} renderHeader={renderListHeader} renderSection={renderSectionHeader} renderSectionFooter={renderSectionFooter} scrollEventThrottle={scrollEventThrottle} scrollIndicatorInsets={memo} scrollPosValue={scrollPosValue} sections={sections} sectionSize={sectionHeaderSize} sectionFooterSize={sectionFooterSize} showsHorizontalScrollIndicator={showsHorizontalScrollIndicator} showsVerticalScrollIndicator={showsVerticalScrollIndicator} stickyHeaderFooter={listHeaderAlwaysMounted} style={style} />;
});
export default r24;