203 lines
9.2 KiB
TypeScript
203 lines
9.2 KiB
TypeScript
/* Metro module 7939; source: components_native/common/Carousel.tsx; dependencies: [6, 7, 15, 17, 18, 31, 27, 33, 4501, 697, 1305, 3868, 2] */
|
|
function _fun63352(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#63352, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8117:6, offset: 0x01b7bc06, size: 528 bytes, params: 8, frame: 23
|
|
var object2;
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_3 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_4 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_5 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_6 = importDefault(18) /* metro dependency 18 */;
|
|
let value = importAll(31) /* metro dependency 31 */;
|
|
const value2 = require(27) /* metro dependency 27 */;
|
|
const env0_7 = value2.View;
|
|
const env0_8 = value2.ScrollView;
|
|
const value3 = require(33) /* metro dependency 33 */;
|
|
const env0_9 = value3.jsx;
|
|
const env0_10 = value3.jsxs;
|
|
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createLegacyClassComponentStyles = createStylesModule.createLegacyClassComponentStyles;
|
|
object2 = {};
|
|
object2.container = {alignItems: 'center'};
|
|
object2.carouselContentWrapper = {flexDirection: 'row'};
|
|
object2.pageIndicator = {'flexDirection': 'row', 'justifyContent': 'space-around', 'alignItems': 'center'};
|
|
const ICON_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.ICON_STRONG;
|
|
object2.activeIndicator = {color: ICON_STRONG};
|
|
const ICON_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.ICON_SUBTLE;
|
|
object2.inactiveIndicator = {color: ICON_SUBTLE};
|
|
const env0_11 = Reflect.apply(createLegacyClassComponentStyles, createStylesModule, [object2]);
|
|
let Component = value.Component;
|
|
const value5 = _fun63357(Component);
|
|
const ThemeContext = (require(3868) /* metro dependency 3868: native */).ThemeContext;
|
|
value5.contextType = ThemeContext;
|
|
value5.defaultProps = {'indicatorSpace': 10, 'indicatorSize': 20};
|
|
Component = value.Component;
|
|
value = _fun63360(Component);
|
|
value.contextType = ThemeContext;
|
|
value.defaultProps = {'pageIndictor': true, 'width': 375};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('components_native/common/Carousel.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _callSuper_63353(a0, a1, a2) { // fn#63353, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8117:225, offset: 0x01b7be16, size: 100 bytes, params: 4, frame: 20
|
|
var r0;
|
|
var Reflect;
|
|
let value = a2;
|
|
const value3 = env0_5(a1);
|
|
const binding = env0_4;
|
|
if (_isNativeReflectConstruct_63354()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value3, value || [], env0_5(a0).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value3.apply(a0, value);
|
|
r0 = value;
|
|
}
|
|
return binding(a0, r0);
|
|
}
|
|
|
|
function _isNativeReflectConstruct_63354() { // fn#63354, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8117:356, offset: 0x01b7be7a, size: 94 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_63354_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun63357(a0) { // fn#63357, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8117:870, offset: 0x01b7bed8, size: 68 bytes, params: 2, frame: 15
|
|
const closure = PageIndicator;
|
|
env0_6(closure, a0);
|
|
return env0_3(closure, [{key: 'render', value: value_63359}]);
|
|
}
|
|
|
|
function _fun63360(a0) { // fn#63360, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8117:1483, offset: 0x01b7c02e, size: 68 bytes, params: 2, frame: 15
|
|
const closure = Carousel;
|
|
env0_6(closure, a0);
|
|
return env0_3(closure, [{key: 'render', value: value_63363}]);
|
|
}
|
|
|
|
function PageIndicator() { // fn#63358, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8117:882, offset: 0x01b7bf1c, size: 42 bytes, params: 1, frame: 16
|
|
env1_2(this, PageIndicator);
|
|
return _callSuper_63353(this, PageIndicator, arguments);
|
|
}
|
|
|
|
function value_63359() { // fn#63359, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8117:1040, offset: 0x01b7bf46, size: 232 bytes, params: 1, frame: 29
|
|
var r7;
|
|
var r17;
|
|
var push;
|
|
var jsxRuntimeEnv1_9Binding;
|
|
var LegacyText;
|
|
var inactiveIndicator;
|
|
var activeIndicator;
|
|
var value4;
|
|
const value2 = env1_11(this.context);
|
|
const {count, activeIndex, indicatorSpace, indicatorSize, pageIndicatorStyle} = this.props;
|
|
const items2 = [];
|
|
const value3 = 0;
|
|
if (value3 < count) {
|
|
r7 = value3;
|
|
while (true) {
|
|
push = items2.push;
|
|
jsxRuntimeEnv1_9Binding = jsxRuntimeEnv1_9;
|
|
LegacyText = (require(1305) /* metro dependency 1305: native */).LegacyText;
|
|
if (r7 === activeIndex) {
|
|
activeIndicator = value2.activeIndicator;
|
|
r17 = activeIndicator;
|
|
} else {
|
|
inactiveIndicator = value2.inactiveIndicator;
|
|
r17 = inactiveIndicator;
|
|
}
|
|
Reflect.apply(push, items2, [<LegacyText style={[{fontSize: indicatorSize},
|
|
r17]} key={r7}>{'•'}</LegacyText>]);
|
|
value4 = typeof r7 === 'bigint' ? r7 + 1n : +r7 + 1;
|
|
if (value4 < count) {
|
|
r7 = value4;
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
return (
|
|
<View style={[value2.pageIndicator, {width: count * indicatorSpace}, pageIndicatorStyle]}>
|
|
{items2}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function Carousel(a0) { // fn#63361, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8117:1495, offset: 0x01b7c072, size: 92 bytes, params: 2, frame: 18
|
|
let value = copyRestArgs(0, undefined);
|
|
env1_2(this, Carousel);
|
|
const _callSuper_63353Binding = _callSuper_63353;
|
|
const items = [];
|
|
arraySpread(items, value, 0, value);
|
|
value = _callSuper_63353Binding(this, Carousel, items);
|
|
value.state = {activeIndex: 0};
|
|
value.onAnimationEnd = onAnimationEnd;
|
|
return value;
|
|
}
|
|
|
|
function value_63363() { // fn#63363, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8117:1827, offset: 0x01b7c144, size: 320 bytes, params: 1, frame: 22
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
const binding = env1_11;
|
|
const context = this.context;
|
|
const value2 = undefined;
|
|
const value3 = binding(context);
|
|
const pageIndicatorStyle = this.props.pageIndicatorStyle;
|
|
const length = this.props.children.length;
|
|
const r5 = this.props.pageIndictor === true && length > 1 ? ((Component) => <Component count={length} activeIndex={this.state.activeIndex} pageIndicatorStyle={pageIndicatorStyle} />)(env1_12) : value2;
|
|
const r8 = this.props.scrollViewProps ?? ({});
|
|
const items2 = [value3.container];
|
|
items2[1] = this.props.style;
|
|
const scrollViewBindingProps2 = {'automaticallyAdjustContentInsets': false, 'horizontal': true,
|
|
'pagingEnabled': true, 'scrollEnabled': null, 'nestedScrollEnabled': true,
|
|
'showsHorizontalScrollIndicator': false, scrollEnabled: length > 1, onMomentumScrollEnd: this.onAnimationEnd,
|
|
...r8};
|
|
value = <View style={value3.carouselContentWrapper} onStartShouldSetResponder={function() {
|
|
return true;
|
|
}}>{this.props.children}</View>;
|
|
value = <ScrollView {...scrollViewBindingProps2}>{value}</ScrollView>;
|
|
return (
|
|
<View style={items2}>
|
|
{value}
|
|
{r5}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function onAnimationEnd({nativeEvent}) { // fn#63362, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8117:1625, owner: Carousel.onAnimationEnd, offset: 0x01b7c0ce, size: 118 bytes, params: 2, frame: 14
|
|
const Math = global.Math;
|
|
const round = Math.round;
|
|
const x = nativeEvent.contentOffset.x;
|
|
const binding = env0_0;
|
|
const value2 = Reflect.apply(round, Math, [x / binding.props.width]);
|
|
binding.setState({activeIndex: value2});
|
|
if (binding.props.onPageChange != null) {
|
|
env0_0.props.onPageChange(value2);
|
|
}
|
|
}
|
|
|