decord/source/components_native/common/Carousel.tsx
2026-08-08 06:10:11 +00:00

114 lines
4.3 KiB
TypeScript

// Module ID: 8701
// Function ID: 8702
// Name: render
// Dependencies: [19, 17, 21, 4303, 712, 4013, 1297, 2]
// Module 8701 (render)
import importAllResult from "noop";
import get_ActivityIndicator from "get ActivityIndicator";
import jsxProd from "jsxProd";
import createCacheKey from "createCacheKey";
let c3;
let c4;
let c5;
let obj1;
let require = arg1;
({ View: obj1, ScrollView: c3 } = get_ActivityIndicator);
({ jsx: c4, jsxs: c5 } = jsxProd);
createCacheKey = { container: { alignItems: "center" }, carouselContentWrapper: { flexDirection: "row" }, pageIndicator: { flexDirection: "row", justifyContent: "space-around", alignItems: "center" }, activeIndicator: null, inactiveIndicator: null };
createCacheKey = { color: require("Themes").colors.ICON_STRONG };
createCacheKey[3] = createCacheKey;
createCacheKey[4] = { color: require("Themes").colors.ICON_SUBTLE };
createCacheKey = createCacheKey.createLegacyClassComponentStyles(createCacheKey);
const Component = importAllResult.Component;
class PageIndicator extends Component {
}
PageIndicator.prototype["render"] = function render() {
let indicatorSpace;
let pageIndicatorStyle;
const tmp = createCacheKey(this.context);
const props = this.props;
const count = props.count;
const children = [];
let num = 0;
({ indicatorSpace, pageIndicatorStyle } = props);
if (0 < count) {
do {
let tmp5 = require;
let tmp6 = dependencyMap;
let tmp4 = callback;
let obj = { fontSize: null };
obj[0] = tmp3;
let items1 = [obj, ];
let tmp7 = num;
obj = { style: null, children: "\u2022" };
items1[1] = num === tmp2 ? tmp.activeIndicator : tmp.inactiveIndicator;
obj[0] = items1;
let arr = children.push(tmp4(require(1297) /* Button */.LegacyText, obj, num));
num = num + 1;
} while (num < count);
}
const style = [tmp.pageIndicator, { width: count * indicatorSpace }, pageIndicatorStyle];
return callback(closure_2, { style, children });
};
PageIndicator.contextType = require("ManaContext").ThemeContext;
PageIndicator.defaultProps = { indicatorSpace: 10, indicatorSize: 20 };
const Component2 = importAllResult.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 = createCacheKey(this.context);
let tmp2 = true === this.props.pageIndictor;
if (tmp2) {
tmp2 = length > 1;
}
let tmp3;
if (tmp2) {
let obj = { count: null, activeIndex: null, pageIndicatorStyle: null };
obj[0] = length;
obj[1] = self.state.activeIndex;
obj[2] = this.props.pageIndicatorStyle;
tmp3 = callback(PageIndicator, obj);
}
let scrollViewProps = self.props.scrollViewProps;
if (scrollViewProps == null) {
scrollViewProps = {};
}
obj = { style: items, children: null };
items = [tmp.container, self.props.style];
obj = { automaticallyAdjustContentInsets: false, horizontal: true, pagingEnabled: true, scrollEnabled: length > 1, nestedScrollEnabled: true, showsHorizontalScrollIndicator: false, onMomentumScrollEnd: self.onAnimationEnd };
const merged = Object.assign(scrollViewProps);
obj.children = callback(closure_2, {
style: tmp.carouselContentWrapper,
onStartShouldSetResponder() {
return true;
},
children: self.props.children
});
const items1 = [callback(closure_3, obj), tmp3];
obj[1] = items1;
return callback2(closure_2, obj);
};
Carousel.contextType = require("ManaContext").ThemeContext;
Carousel.defaultProps = { pageIndictor: true, width: 375 };
obj1 = { color: require("Themes").colors.ICON_SUBTLE };
const result = require("jsxProd").fileFinishedImporting("components_native/common/Carousel.tsx");
export default Carousel;