decord/beta/source/components_native/common/TabBar.tsx
github-actions 30c0bb2ec3 chore: update source for beta 347.10
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4975.js (118.4 MB)
2026-09-24 16:03:38 +00:00

231 lines
7.7 KiB
TypeScript

// Module ID: 10586
// Function ID: 10587
// Name: TabBar
// Dependencies: [32, 19, 17, 1078, 21, 4790, 580, 558, 568, 6923, 1119, 2]
// Exports: default
// Module 10586 (TabBar)
import c from "c" /* 568 */;
import nativeDefault from "native" /* 580 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
require = fn;
get_ActivityIndicator = fn(17);
({ View: closure_4, TouchableWithoutFeedback: hasOwnProperty, FlatList: metroRequire } = get_ActivityIndicator);
const NOOP = fn(1078).NOOP;
const jsx = fn(21).jsx;
const createStyles = fn(4790);
let obj2 = { innerContainer: { flexDirection: "row", alignItems: "stretch" }, tab: { flexGrow: 1, flexBasis: "auto", flexShrink: 0, alignItems: "center", justifyContent: "center", marginBottom: 1, marginHorizontal: 1, padding: 10, borderBottomWidth: 2, borderBottomColor: "transparent" }, tabActive: { backgroundColor: "rgba(0,0,0,0.1)" }, tabSelected: { borderBottomColor: nativeDefault.unsafe_rawColors.BRAND_600 }, container: { flex: 0 } };
let closure_9 = createStyles.createStyles(obj2);
const ReactCompilerGating = fn(558);
let closure_10 = ReactCompilerGating.isReactCompilerEnabled() ? ((arg0) => {
const cResult = c.c(19);
({ children, index } = arg0);
({ isSelected, tabStyle, onSelect } = arg0);
({ tabStyleActive, tabStyleSelected } = arg0);
const tmp2 = closure_9();
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const fn = function s() {
return false;
};
cResult[0] = fn;
let first = fn;
} else {
first = cResult[0];
}
[tmp5, _slicedToArray] = noop.useState(first);
if (cResult[1] === Symbol.for("react.memo_cache_sentinel")) {
class T {
constructor() {
return closure_2(true);
}
}
cResult[1] = T;
} else {
class T {
constructor() {
return closure_2(true);
}
}
}
if (cResult[2] === Symbol.for("react.memo_cache_sentinel")) {
class B {
constructor() {
return closure_2(false);
}
}
cResult[2] = B;
} else {
class B {
constructor() {
return closure_2(false);
}
}
}
if (cResult[3] === index) {
class B {
constructor() {
return closure_2(false);
}
}
if (isSelected) {
class B {
constructor() {
return closure_2(false);
}
}
}
if (tmp5) {
class B {
constructor() {
return closure_2(false);
}
}
}
if (isSelected) {
class B {
constructor() {
return closure_2(false);
}
}
}
if (tmp5) {
class B {
constructor() {
return closure_2(false);
}
}
}
if (cResult[6] === tmp2.tab) {
class B {
constructor() {
return closure_2(false);
}
}
}
const items = [tmp2.tab, tabStyle, null, null, null, null];
cResult[6] = tmp2.tab;
cResult[7] = null;
cResult[8] = null;
cResult[9] = null;
cResult[10] = null;
cResult[11] = tabStyle;
cResult[12] = items;
}
const fn2 = function w() {
return onSelect(index);
};
cResult[3] = index;
cResult[4] = onSelect;
cResult[5] = fn2;
}) : ((index) => {
index = index.index;
({ isSelected, onSelect } = index);
({ children, tabStyle, tabStyleActive, tabStyleSelected } = index);
const tmp = closure_9();
[tmp3, tmp4] = noop.useState(() => false);
c2 = tmp4;
const items = [tmp4];
const items1 = [tmp4];
const callback = noop.useCallback(() => _undefined(true), items);
const items2 = [onSelect, index];
const callback1 = noop.useCallback(() => _undefined(false), items1);
const obj = { accessibilityRole: "tab", onPressIn: callback, onPressOut: callback1, onPress: noop.useCallback(() => onSelect(index), items2), children: null };
const items3 = [tmp.tab, tabStyle, , , , ];
let tabSelected = null;
if (isSelected) {
tabSelected = tmp.tabSelected;
}
items3[2] = tabSelected;
let tabActive = null;
if (tmp3) {
tabActive = tmp.tabActive;
}
items3[3] = tabActive;
let tmp12 = null;
if (isSelected) {
tmp12 = tabStyleSelected;
}
items3[4] = tmp12;
let tmp13 = null;
if (tmp3) {
tmp13 = tabStyleActive;
}
items3[5] = tmp13;
obj.children = <React4 style={items3}>{children}</React4>;
return <hasOwnProperty accessibilityRole="tab" onPressIn={callback} onPressOut={callback1} onPress={noop.useCallback(() => onSelect(index), items2)}>{null}</hasOwnProperty>;
});
const size = fn(2);
const result = size.fileFinishedImporting("components_native/common/TabBar.tsx");
export default function TabBar(tabIndexSelected) {
tabIndexSelected = tabIndexSelected.tabIndexSelected;
const tabStyle = tabIndexSelected.tabStyle;
const tabStyleActive = tabIndexSelected.tabStyleActive;
const tabStyleSelected = tabIndexSelected.tabStyleSelected;
const onSelect = tabIndexSelected.onSelect;
let flag = tabIndexSelected.hideHorizontalScrollbar;
({ initialNumTabsToRender, tabs, containerStyle } = tabIndexSelected);
if (flag === undefined) {
flag = false;
}
let flag2 = tabIndexSelected.scrollToSelectedIndex;
if (flag2 === undefined) {
flag2 = false;
}
tabIndexSelected = undefined;
let first;
const tmp = first();
const ref = tabStyleSelected.useRef(null);
onScrollToIndexFailed = tabStyleSelected.useRef(tabIndexSelected);
const items = [tabIndexSelected];
const effect = tabStyleSelected.useEffect(() => {
closure_7.current = tabIndexSelected;
}, items);
const items1 = [ref, onSelect];
const callback = tabStyleSelected.useCallback((index) => {
onSelect(index);
const current = ref.current;
if (current != null) {
const obj = { index };
current.scrollToIndex(obj);
}
}, items1);
first = tabStyleActive(tabStyleSelected.useState(() => tabIndexSelected), 1)[0];
const items2 = [first];
const effect1 = tabStyleSelected.useEffect(() => {
const timeout = setTimeout(() => {
if (ref2.current === first) {
const current = ref.current;
if (current != null) {
const obj = { index: tmp, viewPosition: 1 };
current.scrollToIndex(obj);
}
}
}, 500);
return () => {
clearTimeout(closure_0);
};
}, items2);
const items3 = [tabIndexSelected, tabStyle, tabStyleActive, tabStyleSelected, flag2, onSelect, callback];
const callback1 = tabStyleSelected.useCallback((arg0, arg1) => "tab-" + arg1, []);
const callback2 = tabStyleSelected.useCallback((children) => {
const index = children.index;
return <closure_10 index={index} isSelected={index === tabIndexSelected} tabStyle={tabStyle} tabStyleActive={tabStyleActive} tabStyleSelected={tabStyleSelected} onSelect={flag2 ? callback : onSelect}>{arg0.item}</closure_10>;
}, items3);
let obj = { style: tmp.container, accessibilityRole: "tablist", accessibilityLabel: null, children: null };
const memo = tabStyleSelected.useMemo(() => {
const Gesture = tabIndexSelected(tabStyle[9]).Gesture;
return Gesture.Native().disallowInterruption(true);
}, []);
const intl = tabIndexSelected(tabStyle[10]).intl;
obj.accessibilityLabel = intl.string(tabIndexSelected(tabStyle[10]).t.t1qXlK);
const obj2 = { gesture: memo, children: null };
const obj3 = { ref, contentContainerStyle: null, horizontal: true, data: tabs, renderItem: callback2, keyExtractor: callback1, initialNumToRender: initialNumTabsToRender, onScrollToIndexFailed, showsHorizontalScrollIndicator: !flag };
const items4 = [containerStyle, tmp.innerContainer];
obj3.contentContainerStyle = items4;
obj2.children = tabIndexSelected(ref, obj3);
obj.children = tabIndexSelected(tabIndexSelected(tabStyle[9]).GestureDetector, obj2);
return tabIndexSelected(onSelect, obj);
};