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

192 lines
5.9 KiB
React

// Metro module 302 (f303).
import _objectWithoutProperties from "./_objectWithoutProperties";
import _classCallCheck from "./_classCallCheck";
import _createClass from "./_createClass";
import _possibleConstructorReturn from "./_possibleConstructorReturn";
import _getPrototypeOf from "./_getPrototypeOf";
import _inherits from "./_inherits";
import { Component, createRef } from "react";
import { jsx } from "react/jsx-runtime";
import dismissKeyboard from "./dismissKeyboard";
import View from "./View";
import StatusBar from "./StatusBar";
import Module309, { Commands } from "./Module309";
import nullthrows from "./nullthrows";
import Module254 from "./Module254";
let _excluded, _excluded2, styles;
let DrawerLayoutAndroid;
let env312 = {};
env312[11] = function _isNativeReflectConstruct() {
let c12236_0;
try {
c12236_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
} catch ($e) {}
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
return !!c12236_0;
};
env312[11] = _isNativeReflectConstruct2;
return _isNativeReflectConstruct2();
};
_excluded = ["drawerBackgroundColor", "onDrawerStateChanged", "renderNavigationView", "onDrawerOpen", "onDrawerClose"];
_excluded2 = ["Idle", "Dragging", "Settling"];
DrawerLayoutAndroid = function DrawerLayoutAndroid(...args) {
_classCallCheck(this, DrawerLayoutAndroid);
const r11 = [...args];
const r10 = _getPrototypeOf(DrawerLayoutAndroid);
const r27 = _possibleConstructorReturn(this, (0, env312[11])() ? Reflect.construct(r10, r11, _getPrototypeOf(this).constructor) : r10.apply(this, r11));
r27._nativeRef = (0, createRef)();
r27.state = {
drawerOpened: false
};
r27._onDrawerSlide = (a0) => {
if (this.props.onDrawerSlide) {
this.props.onDrawerSlide(a0);
}
if (this.props.keyboardDismissMode === "on-drag") {
dismissKeyboard();
}
};
r27._onDrawerOpen = () => {
this.setState({
drawerOpened: true
});
if (this.props.onDrawerOpen) {
this.props.onDrawerOpen();
}
};
r27._onDrawerClose = () => {
this.setState({
drawerOpened: false
});
if (this.props.onDrawerClose) {
this.props.onDrawerClose();
}
};
r27._onDrawerStateChanged = (a0) => {
if (this.props.onDrawerStateChanged) {
this.props.onDrawerStateChanged(_excluded2[a0.nativeEvent.drawerState]);
}
};
return r27;
};
_inherits(DrawerLayoutAndroid, Component);
const r64 = _createClass(DrawerLayoutAndroid, [{
key: "render",
value: function render() {
const props = this.props;
const drawerBackgroundColor = props.drawerBackgroundColor;
const backgroundColor = drawerBackgroundColor !== void 0 ? drawerBackgroundColor : "white";
props.onDrawerStateChanged;
const renderNavigationView = props.renderNavigationView;
props.onDrawerOpen;
props.onDrawerClose;
const rest = _objectWithoutProperties(props, _excluded);
let r13 = this.props.statusBarBackgroundColor != null;
const r43 = <View style={[styles.drawerSubview, {
width: this.props.drawerWidth,
backgroundColor
}]} pointerEvents={this.state.drawerOpened ? "auto" : "none"} collapsable={false}>
{renderNavigationView()}
{r13 ? (0, jsx)(View, {
style: styles.drawerStatusBar
}) : r13}
</View>;
const r55 = [r13 ? (0, jsx)(StatusBar, {
translucent: true,
backgroundColor: this.props.statusBarBackgroundColor
}) : r13, , ,];
if (r13) {
r13 = (0, jsx)(View, {
style: [styles.statusBar, {
backgroundColor: this.props.statusBarBackgroundColor
}]
});
}
r55[1] = r13;
r55[2] = this.props.children;
return <Module309 {...rest} ref={this._nativeRef} drawerBackgroundColor={backgroundColor} drawerWidth={this.props.drawerWidth} drawerPosition={this.props.drawerPosition} drawerLockMode={this.props.drawerLockMode} style={[styles.base, this.props.style]} onDrawerSlide={this._onDrawerSlide} onDrawerOpen={this._onDrawerOpen} onDrawerClose={this._onDrawerClose} onDrawerStateChanged={this._onDrawerStateChanged}>
<View style={styles.mainSubview} collapsable={false}>{r55}</View>
{r43}
</Module309>;
}
}, {
key: "openDrawer",
value: function openDrawer() {
Commands.openDrawer(nullthrows(this._nativeRef.current));
}
}, {
key: "closeDrawer",
value: function closeDrawer() {
Commands.closeDrawer(nullthrows(this._nativeRef.current));
}
}, {
key: "blur",
value: function blur() {
nullthrows(this._nativeRef.current).blur();
}
}, {
key: "focus",
value: function focus() {
nullthrows(this._nativeRef.current).focus();
}
}, {
key: "measure",
value: function measure(a0) {
nullthrows(this._nativeRef.current).measure(a0);
}
}, {
key: "measureInWindow",
value: function measureInWindow(a0) {
nullthrows(this._nativeRef.current).measureInWindow(a0);
}
}, {
key: "measureLayout",
value: function measureLayout(a0, a1, a2) {
nullthrows(this._nativeRef.current).measureLayout(a0, a1, a2);
}
}, {
key: "setNativeProps",
value: function setNativeProps(a0) {
nullthrows(this._nativeRef.current).setNativeProps(a0);
}
}], [{
key: "positions",
get: function get() {
console.warn("Setting DrawerLayoutAndroid drawerPosition using `DrawerLayoutAndroid.positions` is deprecated. Instead pass the string value \"left\" or \"right\"");
return {
Left: "left",
Right: "right"
};
}
}]);
styles = Module254.create({
base: {
flex: 1,
elevation: 16
},
mainSubview: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0
},
drawerSubview: {
position: "absolute",
top: 0,
bottom: 0
},
statusBar: {
height: StatusBar.currentHeight
},
drawerStatusBar: {
position: "absolute",
top: 0,
left: 0,
right: 0,
height: StatusBar.currentHeight,
backgroundColor: "rgba(0, 0, 0, 0.251)"
}
});
export default r64;