Files
discord-decomp/sources/modules/image_upload/native/AddImageDescriptionModal.tsx
T
2026-07-28 01:06:53 +03:00

171 lines
10 KiB
TypeScript

/* Metro module 11138; source: modules/image_upload/native/AddImageDescriptionModal.tsx; dependencies: [57, 31, 27, 4645, 4644, 33, 4501, 697, 566, 1478, 1484, 5463, 10302, 9603, 1244, 7879, 11137, 7681, 9883, 2] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import UseWindowDimensionsNative from '../../screen/useWindowDimensions.native.tsx'; /* Metro dependency 1478 */
import UploadAttachmentStore from '../../../stores/UploadAttachmentStore.tsx'; /* Metro dependency 4644 */
import UseSafeAreaInsetsKeyboardAwareNative from '../../safe_area/useSafeAreaInsetsKeyboardAware.native.tsx'; /* Metro dependency 5463 */
import UploadAttachmentActionCreators from '../../../actions/UploadAttachmentActionCreators.tsx'; /* Metro dependency 7879 */
import ModalStackNavigator from '../../main_tabs_v2/native/utils/ModalStackNavigator.tsx'; /* Metro dependency 9883 */
import UseSafeAreaAvoidingInputsNative from '../../safe_area/useSafeAreaAvoidingInputs.native.tsx'; /* Metro dependency 10302 */
import AddImageDescriptionModalActionCreators from './AddImageDescriptionModalActionCreators.tsx'; /* Metro dependency 11137 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as UseNavigationNativeModule from '../../../design/components/Navigator/native/useNavigation.native.tsx'; /* Metro dependency 1484 */
import * as DraftStoreModule from '../../../stores/DraftStore.tsx'; /* Metro dependency 4645 */
import * as TextAreaNativeModule from '../../../design/components/TextInput/native/TextArea.native.tsx'; /* Metro dependency 7681 */
function _fun85186(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#85186, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11324:6, offset: 0x01f666e1, size: 436 bytes, params: 8, frame: 22
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const env0_5 = value.View;
const env0_6 = value.Image;
const env0_7 = value.ScrollView;
value = require(33) /* metro dependency 33 */;
const env0_10 = value.jsx;
const env0_11 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
object.contentContainer = {backgroundColor: BACKGROUND_BASE_LOW};
const object3 = {alignItems: 'center'};
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object.imageContainer = object3;
const object4 = {'width': '100%', 'resizeMode': 'contain'};
object4.height = undefined;
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object.image = object4;
const TEXT_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_MUTED;
object.placeholderText = {color: TEXT_MUTED};
const env0_12 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/image_upload/native/AddImageDescriptionModal.tsx');
exports.default = AddImageDescriptionModal;
function AddDescription({source, channelId, id}) { // fn#85187, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11324:516, offset: 0x01f66895, size: 929 bytes, params: 2, frame: 35
const env0_3 = undefined;
let env0_4 = undefined;
const styles = useStyles();
const upload = (require(566) /* metro dependency 566: flux */).useStateFromStores([UploadAttachmentStore],
function() {
return UploadAttachmentStore.getUpload(channelId, id, DraftType.ChannelMessage);
});
const value3 = (UseWindowDimensionsNative)({ignoreKeyboard: true});
const width = source.width;
const height = source.height;
const r25 = width != null && height != null ? width === 0 || height === 0 ? 1 : width / height : 1;
const binding = env0_4;
const useState = binding.useState;
const value8 = env0_3(Reflect.apply(useState, binding, [upload?.description ?? '']), 2);
const property = value8[0];
const property2 = value8[1];
env0_4 = env0_4.useRef(property);
const value9 = env0_4.useRef(null);
const value10 = env0_4.useRef(null);
const value11 = (UseNavigationNativeModule).useNavigation();
const insets = (UseSafeAreaInsetsKeyboardAwareNative)({includeKeyboardHeight: true}).insets;
(UseSafeAreaAvoidingInputsNative)({insets: insets,
inputs: [{ref: value9, offset: {type: 'toBottom'}}], scrollViewRef: value10});
env0_4.useEffect(_fun85189, [property]);
env0_4.useEffect(_fun85190, [channelId, id, upload, value11]);
const object3 = {};
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object3.padding = PX_16;
const bottom = insets.bottom;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object3.paddingBottom = bottom + PX_16;
const view = (
<View style={styles.imageContainer}>
<Image style={[styles.image, {aspectRatio: r25, maxHeight: value3.height / 2}]} source={source} />
</View>
);
const TextArea = (TextAreaNativeModule).TextArea;
const object4 = {ref: value9};
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object4.containerStyle = {paddingTop: PX_16};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
object4.label = Reflect.apply(string, intl, [(require(1244) /* metro dependency 1244: indexNative */).t.eOB2eR]);
string = intl.string;
const RNH1jn = (require(1244) /* metro dependency 1244: indexNative */).t.RNH1jn;
object4.placeholder = Reflect.apply(string, intl, [RNH1jn]);
object4.value = property;
object4.onChange = property2;
object4.placeholderTextColor = styles.placeholderText.color;
object4.maxLength = 1000;
object4.autoFocus = true;
return (
<ScrollView
ref={value10}
style={styles.contentContainer}
contentContainerStyle={object3}
>
{view}
<TextArea {...object4} />
</ScrollView>
);
function _fun85189() { // fn#85189, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11324:1047, offset: 0x01f66c61, size: 21 bytes, params: 1, frame: 2
env0_4.current = env0_3;
}
function _fun85190() { // fn#85190, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11324:1084, offset: 0x01f66c76, size: 38 bytes, params: 1, frame: 12
const binding = env0_5;
binding.setOptions({headerRight: headerRight_85191});
function headerRight_85191(a0) { // fn#85191, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11324:1115, offset: 0x01f66c9c, size: 112 bytes, params: 2, frame: 17
var environment;
let value = environment.__proto__.__proto__;
const getRenderHeaderTextButton = require(dependencyMap[13]).getRenderHeaderTextButton;
const intl = require(dependencyMap[14]).intl;
value = Reflect.apply(getRenderHeaderTextButton, value, [intl.string(require(dependencyMap[14]).t['R3BPH+']),
_fun85192]);
const object = {};
copyDataProperties(object, a0, dependencyMap);
return value(object);
function _fun85192() { // fn#85192, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11324:1197, offset: 0x01f66d0c, size: 123 bytes, params: 1, frame: 22
const value = environment.__proto__.__proto__.__proto__;
const defaultImport = UploadAttachmentActionCreators;
const update = defaultImport.update;
const channelIdBinding = channelId;
const idBinding = id;
const ChannelMessage = DraftType.ChannelMessage;
const object = {};
copyDataProperties(object, upload, ChannelMessage);
object['description'] = env2_4.current;
Reflect.apply(update, defaultImport, [channelIdBinding, idBinding, ChannelMessage, object]);
(AddImageDescriptionModalActionCreators).close();
}
}
}
}
function AddImageDescriptionModal({source, channelId, id}) { // fn#85193, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11324:1931, offset: 0x01f66d87, size: 149 bytes, params: 2, frame: 19
const intl = (IndexNativeModule).intl;
return (
<ModalStackNavigator
screenKey="addImageDescriptionModal"
title={intl.string((IndexNativeModule).t['5S2AK+'])}
render={render_85194}
/>
);
function AddImageDescriptionModalRender() { // fn#85194, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11324:2106, owner: AddImageDescriptionModal.render, offset: 0x01f66e1c, size: 50 bytes, params: 1, frame: 14
return (
<AddDescription
source={source}
channelId={channelId}
id={id}
/>
);
}
}
}
global.__d(_fun85186, 11138, [57, 31, 27, 4645, 4644, 33, 4501, 697, 566, 1478, 1484, 5463, 10302, 9603, 1244, 7879,
11137, 7681, 9883,
2]) /* metro module 11138, dependencies: [57, 31, 27, 4645, 4644, 33, 4501, 697, 566, 1478, 1484, 5463, 10302, 9603, 1244, 7879, 11137, 7681, 9883, 2] */;