Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4825.js (118.4 MB)
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
// Module ID: 15959
|
|
// Function ID: 15960
|
|
// Name: useScrollToInitialIndexOnce
|
|
// Dependencies: [19, 2]
|
|
// Exports: useScrollToInitialIndexOnce
|
|
|
|
// Module 15959 (useScrollToInitialIndexOnce)
|
|
import noop from "module_19" /* 19 */;
|
|
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/collectibles/native/hooks/useScrollToInitialIndexOnce.tsx");
|
|
|
|
export const INITIAL_SCROLL_DELAY_MS = 100;
|
|
export const useScrollToInitialIndexOnce = function useScrollToInitialIndexOnce(initialScrollIndex) {
|
|
initialScrollIndex = initialScrollIndex.initialScrollIndex;
|
|
const shouldScroll = initialScrollIndex.shouldScroll;
|
|
const flashListRef = initialScrollIndex.flashListRef;
|
|
let num = initialScrollIndex.afterMs;
|
|
if (num === undefined) {
|
|
num = 100;
|
|
}
|
|
const resetKey = initialScrollIndex.resetKey;
|
|
noop.useRef(false);
|
|
noop.useRef(resetKey);
|
|
const items = [shouldScroll, initialScrollIndex, num, flashListRef, resetKey];
|
|
const effect = noop.useEffect(() => {
|
|
if (ref2.current !== resetKey) {
|
|
ref2.current = resetKey;
|
|
ref.current = false;
|
|
}
|
|
let tmp2 = null != initialScrollIndex && shouldScroll;
|
|
if (tmp2) {
|
|
tmp2 = !ref.current;
|
|
}
|
|
if (tmp2) {
|
|
ref.current = true;
|
|
const _setTimeout = setTimeout;
|
|
const timerId = setTimeout(() => {
|
|
const current = ref.current;
|
|
if (current != null) {
|
|
const obj = { animated: true, index };
|
|
current.scrollToIndex(obj);
|
|
}
|
|
}, num);
|
|
}
|
|
}, items);
|
|
};
|