Files
discord-decomp/_bundle/FullScreenOverlay.js
T
2026-11-01 12:12:55 +02:00

197 lines
4.9 KiB
JavaScript

// Metro module 13476 (f13477).
import * as _classCallCheck from "./_classCallCheck";
import * as __createClass from "./_createClass";
import * as _possibleConstructorReturn from "./_possibleConstructorReturn";
import * as _getPrototypeOf from "./_getPrototypeOf";
import * as __inherits from "./_inherits";
import * as _Module19 from "react";
import * as Module17 from "react-native";
import { Dimensions, Image, View } from "react-native";
import * as Module21 from "react/jsx-runtime";
let r48;
let c9351_6;
let env9351 = {};
env9351[3] = function _isNativeReflectConstruct() {
let c20488_0;
try {
c20488_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
} catch ($e) {}
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
return !!c20488_0;
};
env9351[3] = _isNativeReflectConstruct2;
return _isNativeReflectConstruct2();
};
const WeakMap2 = globalThis.WeakMap;
let r41 = void 0;
if (typeof WeakMap2 === "function") {
r41 = new WeakMap();
new WeakMap();
}
L26: {
if (_Module19) {
const __esModule = _Module19.__esModule;
r48 = _Module19;
if (__esModule) {
break L26;
}
}
const r17 = {
__proto__: null,
default: _Module19
};
r48 = r17;
if (_Module19 !== null) {
if (typeof _Module19 !== "object") {
r48 = r17;
if (typeof _Module19 !== "function") {
break L26;
}
}
if (r41) {
if (r41.has(_Module19)) {
r48 = r41.get(_Module19);
break L26;
}
r41.set(_Module19, r17);
}
r48 = r17;
for (const key in _Module19) {
r48 = r17;
if (key !== "default" && ({}).hasOwnProperty.call(_Module19, key)) {
const defineProperty = Object.defineProperty;
const r59 = defineProperty && Object.getOwnPropertyDescriptor(_Module19, key);
L23: {
if (r59) {
if (!r59.get && !r59.set) {
break L23;
}
defineProperty(r17, key, r59);
continue;
}
}
r17[key] = _Module19[key];
}
}
r48 = r17;
}
}
c9351_6 = {
container: {
position: "absolute",
left: 0,
top: 0,
right: 0,
bottom: 0,
zIndex: 1000,
opacity: 0.25
},
debugContainer: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
justifyContent: "center",
alignItems: "center",
backgroundColor: "transparent",
zIndex: 2000
},
debugTextContainer: {
backgroundColor: "lightgray",
margin: 50,
padding: 20
},
debugText: {
color: "red",
fontSize: 16,
marginBottom: 10
}
};
const Component = r48.Component;
const FullScreenOverlay = function FullScreenOverlay(a0) {
_classCallCheck(this, FullScreenOverlay);
const r10 = [a0];
const r9 = _getPrototypeOf(FullScreenOverlay);
const r22 = _possibleConstructorReturn(this, (0, env9351[3])() ? Reflect.construct(r9, r10, _getPrototypeOf(this).constructor) : r9.apply(this, r10));
r22.state = {
opacity: c9351_6.container.opacity,
uri: null,
justifyContent: "center",
alignItems: "center"
};
a0.emitter.on("overlay", (a0) => {
this.setState({
...this.state,
...a0
});
});
return r22;
};
__inherits(FullScreenOverlay, Component);
export default __createClass(FullScreenOverlay, [{
key: "createContainerStyle",
value: function createContainerStyle() {
const state = this.state;
const { opacity, justifyContent, alignItems } = state;
const r12 = Dimensions.get("window");
return {
...c9351_6.container,
opacity,
width: r12.width,
height: r12.height,
justifyContent,
alignItems
};
}
}, {
key: "renderDebug",
value: function renderDebug() {
this.state.showDebug;
return null;
}
}, {
key: "render",
value: function render() {
let r32, r33, children;
const state = this.state;
const { uri, width, height, growToWindow, resizeMode, marginLeft: marginLeft2 = 0, marginRight: marginRight2 = 0, marginTop: marginTop2 = 0, marginBottom } = state;
const style = {
width,
height,
marginTop: marginTop2,
marginRight: marginRight2,
marginBottom: marginBottom !== void 0 ? marginBottom : 0,
marginLeft: marginLeft2
};
if (growToWindow) {
const r23 = Dimensions.get("window");
style.width = r23.width;
style.height = r23.height;
}
const jsx = Module21.jsx;
if (uri) {
children = jsx(Image, {
source: {
uri
},
style,
resizeMode: growToWindow ? resizeMode : null
});
r32 = Module17;
r33 = Module21;
} else {
children = jsx(View, {});
r32 = Module17;
r33 = Module21;
}
return (0, r33.jsxs)(r33.Fragment, {
children: [(0, r33.jsx)(r32.View, {
style: this.createContainerStyle(),
pointerEvents: "none",
children
}), this.renderDebug()]
});
}
}]);