63 lines
2.6 KiB
React
63 lines
2.6 KiB
React
// Metro module 5472 (f5473).
|
|
import Module19, { useEffect, useImperativeHandle, useLayoutEffect } from "react";
|
|
import { useRecyclerViewContext } from "./Module5435";
|
|
import { CompatView } from "./Module5466";
|
|
import { ViewHolder } from "./Module5470";
|
|
export const ViewHolderCollection = ({ data, renderStack, getLayout, refHolder, onSizeChanged, renderItem, extraData, viewHolderCollectionRef, getChildContainerLayout, onCommitLayoutEffect, CellRendererComponent, ItemSeparatorComponent, onCommitEffect, horizontal, getAdjustmentMargin, currentStickyIndex, hideStickyHeaderRelatedCell, isInLastRow, inverted }) => {
|
|
const [state, setState] = Module19.useState(0);
|
|
let r38 = getChildContainerLayout();
|
|
const r4 = r38 == null;
|
|
const r14 = horizontal ? r4 ? void 0 : r38.height : r4 ? void 0 : r38.width;
|
|
const recyclerViewContext = useRecyclerViewContext();
|
|
useLayoutEffect(() => {
|
|
if (state > 0 && recyclerViewContext != null) {
|
|
recyclerViewContext.layout();
|
|
}
|
|
}, [r14]);
|
|
useLayoutEffect(() => {
|
|
if (state > 0 && onCommitLayoutEffect != null) {
|
|
onCommitLayoutEffect();
|
|
}
|
|
}, [state]);
|
|
useEffect(() => {
|
|
if (state > 0 && onCommitEffect != null) {
|
|
onCommitEffect();
|
|
}
|
|
}, [state]);
|
|
useImperativeHandle(viewHolderCollectionRef, () => ({
|
|
commitLayout: () => {
|
|
setState((prevState) => prevState + 1);
|
|
}
|
|
}), [setState]);
|
|
const r58 = data ? data.length > 0 : data;
|
|
const r63 = {
|
|
width: horizontal ? r38?.width : void 0,
|
|
height: r38?.height,
|
|
marginTop: horizontal ? void 0 : getAdjustmentMargin(),
|
|
marginLeft: horizontal ? getAdjustmentMargin() : void 0,
|
|
opacity: state > 0 ? 1 : 0
|
|
};
|
|
const style = r58 ? r63 : r58;
|
|
if (r38) {
|
|
r38 = r58;
|
|
}
|
|
if (r38) {
|
|
r38 = Array.from(renderStack.entries(), (a0) => {
|
|
const [key, r30] = a0;
|
|
const index = r30.index;
|
|
const item = data[index];
|
|
const trailingItem = ItemSeparatorComponent ? isInLastRow(index) ? void 0 : data[index + 1] : void 0;
|
|
const index2 = index;
|
|
const layout = {
|
|
...getLayout(index2)
|
|
};
|
|
let hidden = hideStickyHeaderRelatedCell;
|
|
if (hideStickyHeaderRelatedCell) {
|
|
hidden = currentStickyIndex === index;
|
|
}
|
|
return <ViewHolder key={key} index={index2} item={item} trailingItem={trailingItem} layout={layout} refHolder={refHolder} onSizeChanged={onSizeChanged} target="Cell" renderItem={renderItem} extraData={extraData} CellRendererComponent={CellRendererComponent} ItemSeparatorComponent={ItemSeparatorComponent} horizontal={horizontal} hidden={hidden} inverted={inverted} />;
|
|
});
|
|
}
|
|
return <CompatView style={style}>{r38}</CompatView>;
|
|
};
|