68 lines
2.5 KiB
TypeScript
68 lines
2.5 KiB
TypeScript
// Metro module 9611 (f9612).
|
|
import { memo, useCallback, useMemo } from "react";
|
|
import { View } from "react-native";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import { GIF_PICKER_GUTTER_SPACING } from "./GIFPickerUtils";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { dismissGlobalKeyboard } from "../../../utils/native/KeyboardManagerUtils";
|
|
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
|
|
import FastImage from "../../../components_native/common/FastImage";
|
|
const useStyles = createStyles((a0) => ({
|
|
container: {
|
|
paddingBottom: GIF_PICKER_GUTTER_SPACING,
|
|
paddingHorizontal: GIF_PICKER_GUTTER_SPACING / 2,
|
|
borderRadius: Module712.radii.xs,
|
|
width: "100%",
|
|
height: a0,
|
|
flex: 1
|
|
},
|
|
gifImage: {
|
|
backgroundColor: Module712.colors.BORDER_SUBTLE,
|
|
borderRadius: Module712.radii.xs,
|
|
flex: 1
|
|
},
|
|
gifImageSelected: {
|
|
borderWidth: 2,
|
|
borderColor: Module712.colors.BACKGROUND_BRAND
|
|
}
|
|
}));
|
|
const r28 = memo(function(a0) {
|
|
const styles = useStyles(a0.height);
|
|
return <View style={styles.container}>
|
|
<View style={styles.gifImage} />
|
|
</View>;
|
|
});
|
|
export default function GIFPickerItemView(props) {
|
|
const { onPressGIF, item, index, height, selected } = props;
|
|
const styles = useStyles(height);
|
|
const callback = useCallback(() => {
|
|
onPressGIF(item, index);
|
|
dismissGlobalKeyboard();
|
|
}, [item, index, onPressGIF]);
|
|
const callback2 = useCallback(() => {
|
|
ActionSheetActionCreators.openLazy(import("./GIFPickerItemActionSheet"), "GIFPickerItemActionSheet", {
|
|
item
|
|
}, "stack");
|
|
dismissGlobalKeyboard();
|
|
}, [item]);
|
|
return <PressableOpacity style={styles.container} accessibilityRole="button" accessibilityLabel={useMemo(() => {
|
|
const r7 = item.src.split("/").pop();
|
|
let r13 = r7 == null ? void 0 : r7.split(".")[0];
|
|
if (r13 == null) {
|
|
r13 = intl.formatToPlainString(t["5iIGZI"], {
|
|
index: index + 1
|
|
});
|
|
}
|
|
return r13;
|
|
}, [index, item.src])} accessibilityState={selected != null ? {
|
|
selected
|
|
} : void 0} onPress={callback} onLongPress={callback2}>
|
|
<FastImage style={selected === true ? [styles.gifImage, styles.gifImageSelected] : styles.gifImage} source={{
|
|
uri: item.src
|
|
}} />
|
|
</PressableOpacity>;
|
|
};
|
|
export { r28 as GIFPickerItemPlaceholder };
|