react-native-ios-context-menu icon indicating copy to clipboard operation
react-native-ios-context-menu copied to clipboard

Add "FIT" to MenuPreviewSize

Open mozzius opened this issue 2 years ago • 0 comments

I'm trying to recreate twitter's context menu behaviour for images. Images are usually cropped, and long pressing them grows them to their natural aspect ratio, as large as possible. Here are some examples:

  1. Cropped image before long press. Note how it's basically square

image

  1. Long pressing it grows it to be full height, and half width.

image

  1. Here's an example of a wide, short image:

image

However, previewSize: "STRETCH" seems to just set the preview to the maximum possible size, regardless of the size of the rendered preview.

I can either set the image to maintain it's aspect ratio, like so:

Simulator Screenshot - iPhone 15 - 2023-12-13 at 14 48 18

Or I can set it to fill the area, like so:

Simulator Screenshot - iPhone 15 - 2023-12-13 at 14 47 53

I'd love if I could set the preview area to respect the aspect ratio of the original image (alternatively, I wouldn't mind passing in an "aspectRatio" prop)

mozzius avatar Dec 13 '23 15:12 mozzius