decord/source/__polyfill/01xxx/module_1606.js
github-actions f0f877e8ce chore: update source for alpha 347.1
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4824.js (118.4 MB)
2026-09-15 14:23:42 +00:00

91 lines
3.2 KiB
JavaScript

// Module ID: 1606
// Function ID: 1607
// Dependencies: [19, 1487]
// Exports: useScrollToTop
// Module 1606
import BaseNavigationContainer from "BaseNavigationContainer" /* 1487 */;
import noop from "module_19" /* 19 */;
require = arg1;
export const useScrollToTop = function useScrollToTop(ref) {
closure_0 = ref;
const context = noop.useContext(BaseNavigationContainer.NavigationContext);
const route = BaseNavigationContainer.useRoute();
if (undefined === context) {
const _Error = Error;
const error = new Error("Couldn't find a navigation object. Is your component inside NavigationContainer?");
throw error;
} else {
let items = [context, ref, route.key];
const effect = obj.useEffect(() => {
const items = [];
for (let parent = closure_1; parent; parent = parent.getParent()) {
if ("tab" === parent.getState().type) {
let arr = items.push(parent);
}
}
if (0 !== items.length) {
closure_1 = items.map((addListener) => addListener.addListener("tabPress", (arg0) => {
const defaultPrevented = arg0;
focused = focused.isFocused();
let hasItem = ref.includes(focused);
if (!hasItem) {
hasItem = focused.getState().routes[0].key === key.key;
}
const animationFrame = requestAnimationFrame(() => {
if (null == ref.current) {
let tmp3 = closure_1;
if (closure_1) {
tmp3 = hasItem;
}
if (tmp3) {
tmp3 = null;
}
if (tmp3) {
tmp3 = !defaultPrevented.defaultPrevented;
}
if (tmp3) {
if ("scrollToTop" in null) {
null.scrollToTop();
} else if ("scrollTo" in null) {
null.scrollTo({ y: 0, animated: true });
} else if ("scrollToOffset" in null) {
null.scrollToOffset({ offset: 0, animated: true });
} else if ("scrollResponderScrollTo" in null) {
const result = null.scrollResponderScrollTo({ y: 0, animated: true });
}
}
} else {
if (!("scrollToTop" in tmp.current)) {
if (!("scrollTo" in tmp.current)) {
if (!("scrollToOffset" in tmp.current)) {
if (!("scrollResponderScrollTo" in tmp.current)) {
const current = tmp.current;
if ("getScrollResponder" in tmp.current) {
let current3 = current.getScrollResponder();
} else {
const current2 = tmp.current;
if ("getNode" in current) {
current3 = current2.getNode();
} else {
current3 = current2;
}
}
}
}
}
}
current3 = tmp.current;
}
});
}));
return () => {
const item = closure_1.forEach((fn) => fn());
};
}
}, items);
}
obj = noop;
};