decord/stable/source/components_native/common/Carousel.tsx
github-actions e2bc0408ee chore: update source for stable 346.13
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-22 22:11:40 +00:00

105 lines
4.1 KiB
TypeScript

// Module ID: 9491
// Function ID: 9492
// Name: Carousel
// Dependencies: [19, 17, 21, 4636, 576, 4347, 1176, 2]
// Module 9491 (Carousel)
import nativeDefault from "native" /* 576 */;
import native from "native" /* 1176 */;
import noop from "module_19" /* 19 */;
require = fn;
get_ActivityIndicator = fn(17);
({ View: c2, ScrollView: c3 } = get_ActivityIndicator);
const jsxProd = fn(21);
({ jsx: closure_4, jsxs: hasOwnProperty } = jsxProd);
const createStyles = fn(4636);
let obj2 = { container: { alignItems: "center" }, carouselContentWrapper: { flexDirection: "row" }, pageIndicator: { flexDirection: "row", justifyContent: "space-around", alignItems: "center" }, activeIndicator: { color: nativeDefault.colors.ICON_STRONG }, inactiveIndicator: null };
let obj3 = { color: nativeDefault.colors.ICON_STRONG };
obj2.inactiveIndicator = { color: nativeDefault.colors.ICON_SUBTLE };
let closure_6 = createStyles.createLegacyClassComponentStyles(obj2);
const Component = noop.Component;
class PageIndicator extends Component {
}
PageIndicator.prototype["render"] = function render() {
const tmp = closure_6(this.context);
const props = this.props;
const count = props.count;
const items = [];
let num = 0;
({ indicatorSpace, pageIndicatorStyle } = props);
if (0 < count) {
do {
let tmp4 = React4;
let obj = { fontSize: tmp3 };
let items1 = [obj, ];
let obj2 = { style: null, children: "\u2022" };
items1[1] = num === tmp2 ? tmp.activeIndicator : tmp.inactiveIndicator;
obj2.style = items1;
let arr = items.push(tmp4(native.LegacyText, obj2, num));
num = num + 1;
} while (num < count);
}
const obj3 = { style: null, children: items };
const items2 = [tmp.pageIndicator, { width: count * indicatorSpace }, pageIndicatorStyle];
obj3.style = items2;
return React4(React2, obj3);
};
PageIndicator.contextType = fn(4347).ThemeContext;
PageIndicator.defaultProps = { indicatorSpace: 10, indicatorSize: 20 };
const Component2 = noop.Component;
class Carousel extends Component2 {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
closure_0 = applyArgumentsResult;
applyArgumentsResult.state = { activeIndex: 0 };
applyArgumentsResult.onAnimationEnd = function onAnimationEnd(nativeEvent) {
const rounded = Math.round(nativeEvent.nativeEvent.contentOffset.x / applyArgumentsResult.props.width);
applyArgumentsResult.setState({ activeIndex: rounded });
const props = applyArgumentsResult.props;
const onPageChange = props.onPageChange;
if (onPageChange != null) {
onPageChange(rounded);
}
};
return applyArgumentsResult;
}
}
Carousel.prototype["render"] = function render() {
const self = this;
const tmp = closure_6(this.context);
let tmp2 = true === this.props.pageIndictor;
if (tmp2) {
tmp2 = length > 1;
}
let tmp3;
if (tmp2) {
const obj = { count: length, activeIndex: self.state.activeIndex, pageIndicatorStyle: this.props.pageIndicatorStyle };
tmp3 = React4(PageIndicator, obj);
}
let scrollViewProps = self.props.scrollViewProps;
if (scrollViewProps == null) {
scrollViewProps = {};
}
const obj2 = { style: null, children: null };
const items = [tmp.container, self.props.style];
obj2.style = items;
const obj3 = { automaticallyAdjustContentInsets: false, horizontal: true, pagingEnabled: true, scrollEnabled: this.props.children.length > 1, nestedScrollEnabled: true, showsHorizontalScrollIndicator: false, onMomentumScrollEnd: self.onAnimationEnd };
const merged = Object.assign(scrollViewProps);
obj3.children = React4(React2, {
style: tmp.carouselContentWrapper,
onStartShouldSetResponder() {
return true;
},
children: self.props.children
});
const items1 = [React4(React3, obj3), tmp3];
obj2.children = items1;
return hasOwnProperty(React2, obj2);
};
Carousel.contextType = fn(4347).ThemeContext;
Carousel.defaultProps = { pageIndictor: true, width: 375 };
const size = fn(2);
const result = size.fileFinishedImporting("components_native/common/Carousel.tsx");
export default Carousel;