71 lines
2.9 KiB
TypeScript
71 lines
2.9 KiB
TypeScript
// Metro module 11387 (f11388).
|
|
import { useCallback } from "react";
|
|
import { View } from "react-native";
|
|
import { POLL_CREATION_IMAGE_INPUT_ACTION_SHEET_KEY } from "../PollsConstants";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import useRenderPollAnswerImage from "./useRenderPollAnswerImage";
|
|
import { dismissKeyboard } from "../../../utils/native/ChatInputUtils";
|
|
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
|
|
import { ActionSheet } from "../../../design/components/Sheet/native/ActionSheet.native";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { Spacer } from "../../../design/void/native";
|
|
import { ActionSheetRow } from "../../../design/components/Sheet/native/ActionSheetRow.native";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { openEditPollCreationImageAltTextModal } from "./EditPollCreationImageAltTextModalActionCreators";
|
|
const useStyles = createStyles({
|
|
emojiContainer: {
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
marginHorizontal: 24
|
|
},
|
|
emojiIcon: {
|
|
marginRight: 12,
|
|
borderRadius: Module712.radii.sm
|
|
}
|
|
});
|
|
export default function ImageInputAnswerActionSheet(props) {
|
|
const { channelId, index, answer, onSaveAltText, onRemoveAnswerImage, openExpressionPicker } = props;
|
|
const styles = useStyles();
|
|
const renderPollAnswerImage = useRenderPollAnswerImage(channelId, answer.localCreationAnswerId, answer.image, 40, 40);
|
|
const { renderImage, upload } = renderPollAnswerImage;
|
|
const r2 = upload != null || answer.image?.emoji != null;
|
|
const callback = useCallback(() => {
|
|
dismissKeyboard();
|
|
ActionSheetActionCreators.hideActionSheet(POLL_CREATION_IMAGE_INPUT_ACTION_SHEET_KEY);
|
|
}, []);
|
|
let r46 = r2;
|
|
if (r46) {
|
|
const r51 = [<View style={styles.emojiIcon}>{renderImage}</View>, ,];
|
|
const image = answer.image;
|
|
r51[1] = <Text variant="text-md/bold" color="mobile-text-heading-primary">
|
|
{`:${image == null ? void 0 : image.emoji?.name}:`}
|
|
</Text>;
|
|
r46 = <View style={styles.emojiContainer}>{r51}</View>;
|
|
}
|
|
return <ActionSheet startExpanded>
|
|
{r46}
|
|
<Spacer size={21} />
|
|
<ActionSheetRow.Group hasIcons={false}>
|
|
<ActionSheetRow label={r2 ? intl.string(t.CZeRhU) : intl.string(t.dzcU1Q)} onPress={() => {
|
|
callback();
|
|
openExpressionPicker();
|
|
}} />
|
|
{upload != null ? <ActionSheetRow label={intl.string(t.w7x2t4)} onPress={() => {
|
|
callback();
|
|
openEditPollCreationImageAltTextModal({
|
|
channelId,
|
|
answer,
|
|
index,
|
|
onSave: onSaveAltText,
|
|
imageSize: 40
|
|
});
|
|
}} /> : null}
|
|
{r2 ? <ActionSheetRow label={intl.string(t.IhMxgu)} onPress={() => {
|
|
onRemoveAnswerImage(index);
|
|
callback();
|
|
}} /> : null}
|
|
</ActionSheetRow.Group>
|
|
</ActionSheet>;
|
|
};
|