diff options
Diffstat (limited to 'src/view/com/composer/photos/Gallery.tsx')
-rw-r--r-- | src/view/com/composer/photos/Gallery.tsx | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/view/com/composer/photos/Gallery.tsx b/src/view/com/composer/photos/Gallery.tsx index 83c1e3c80..369f08d74 100644 --- a/src/view/com/composer/photos/Gallery.tsx +++ b/src/view/com/composer/photos/Gallery.tsx @@ -21,6 +21,7 @@ import {ComposerImage, cropImage} from '#/state/gallery' import {Text} from '#/view/com/util/text/Text' import {useTheme} from '#/alf' import * as Dialog from '#/components/Dialog' +import {EditImageDialog} from './EditImageDialog' import {ImageAltTextDialog} from './ImageAltTextDialog' const IMAGE_GAP = 8 @@ -144,12 +145,15 @@ const GalleryItem = ({ const t = useTheme() const altTextControl = Dialog.useDialogControl() + const editControl = Dialog.useDialogControl() const onImageEdit = () => { if (isNative) { cropImage(image).then(next => { onChange(next) }) + } else { + editControl.open() } } @@ -185,21 +189,15 @@ const GalleryItem = ({ </Text> </TouchableOpacity> <View style={imageControlsStyle}> - {isNative && ( - <TouchableOpacity - testID="editPhotoButton" - accessibilityRole="button" - accessibilityLabel={_(msg`Edit image`)} - accessibilityHint="" - onPress={onImageEdit} - style={styles.imageControl}> - <FontAwesomeIcon - icon="pen" - size={12} - style={{color: colors.white}} - /> - </TouchableOpacity> - )} + <TouchableOpacity + testID="editPhotoButton" + accessibilityRole="button" + accessibilityLabel={_(msg`Edit image`)} + accessibilityHint="" + onPress={onImageEdit} + style={styles.imageControl}> + <FontAwesomeIcon icon="pen" size={12} style={{color: colors.white}} /> + </TouchableOpacity> <TouchableOpacity testID="removePhotoButton" accessibilityRole="button" @@ -237,6 +235,12 @@ const GalleryItem = ({ image={image} onChange={onChange} /> + + <EditImageDialog + control={editControl} + image={image} + onChange={onChange} + /> </View> ) } |