68 lines
2.1 KiB
React
68 lines
2.1 KiB
React
// Metro module 5485 (f5486).
|
|
import Module19, { useLayoutEffect, useMemo, useRef } from "react";
|
|
import { useRecyclerViewContext, RecyclerViewContextProvider } from "./Module5435";
|
|
import { useLayoutState } from "./Module5434";
|
|
const r26 = Module19.memo(({ children, onCommitLayoutEffect }) => {
|
|
let memo;
|
|
const recyclerViewContext = useRecyclerViewContext();
|
|
const [, r26] = useLayoutState(0);
|
|
let c14877_2 = r26;
|
|
const current = useRef(new Set()).current;
|
|
useLayoutEffect(() => {
|
|
if (!(current.size > 0) && onCommitLayoutEffect != null) {
|
|
onCommitLayoutEffect();
|
|
}
|
|
});
|
|
memo = useMemo(() => ({
|
|
layout: () => {
|
|
c14877_2((a0) => a0 + 1);
|
|
},
|
|
getRef: () => {
|
|
let r5 = recyclerViewContext == null ? void 0 : recyclerViewContext.getRef();
|
|
if (r5 == null) {
|
|
r5 = null;
|
|
}
|
|
return r5;
|
|
},
|
|
getParentRef: () => {
|
|
let r5 = recyclerViewContext == null ? void 0 : recyclerViewContext.getParentRef();
|
|
if (r5 == null) {
|
|
r5 = null;
|
|
}
|
|
return r5;
|
|
},
|
|
getParentScrollViewRef: () => {
|
|
let r5 = recyclerViewContext == null ? void 0 : recyclerViewContext.getParentScrollViewRef();
|
|
if (r5 == null) {
|
|
r5 = null;
|
|
}
|
|
return r5;
|
|
},
|
|
getScrollViewRef: () => {
|
|
let r5 = recyclerViewContext == null ? void 0 : recyclerViewContext.getScrollViewRef();
|
|
if (r5 == null) {
|
|
r5 = null;
|
|
}
|
|
return r5;
|
|
},
|
|
markChildLayoutAsPending: (a0) => {
|
|
if (recyclerViewContext != null) {
|
|
recyclerViewContext.markChildLayoutAsPending(a0);
|
|
}
|
|
current.add(a0);
|
|
},
|
|
unmarkChildLayoutAsPending: (a0) => {
|
|
if (recyclerViewContext != null) {
|
|
recyclerViewContext.unmarkChildLayoutAsPending(a0);
|
|
}
|
|
if (current.has(a0)) {
|
|
current.delete(a0);
|
|
memo.layout();
|
|
}
|
|
}
|
|
}), [recyclerViewContext, current, r26]);
|
|
return <RecyclerViewContextProvider value={memo}>{children}</RecyclerViewContextProvider>;
|
|
});
|
|
r26.displayName = "LayoutCommitObserver";
|
|
export { r26 as LayoutCommitObserver };
|