Tommy Pham
Tommy Pham

Reputation: 91

How to add a preview image to Navigator.share()

I'm currently using Navigator.share() to invoke the native share API. Everything is fine and dandy except what I'm sharing is a link to an image.

On iOS, there is a preview image that shows up when using Safari's share icon and I can't figure out how to get that to show up for Navigator.share() as well.

Navigator.share()

Here is an example of the same page being shared using Safari's browse share tool.

Safari's browser share tool

Upvotes: 2

Views: 6450

Answers (1)

Tommy Pham
Tommy Pham

Reputation: 91

I believe I came across a solution.

The data Navigator.share() is expecting can contain the properties: title, text, url, and files. I only use title, text, and url. I decided to omit title and text and it worked! I'm guessing it's because when they are set, the API doesn't use the meta information provided by the page to produce the preview image.

Upvotes: 7

Related Questions