Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@lowkey/react-native-link-preview

max-prokopenko304MIT0.2.2TypeScript support: included

Get link metadata to show url preview in React Native.

react-native, ios, url preview, link preview, preview generation, url metadata, link metadata, youtube link preview, spotify link preview, facebook link preview

readme

@lowkey/react-native-link-preview

Fully native link metadata generation to create link preview in React Native. Metadata generation happens on native thread, so the JS thread stays unblocked with 60fps.

Supports most of the basic links, Spotify, Youtube and Facebook.

Supported on iOS and Android.

https://user-images.githubusercontent.com/20337903/124804885-73a6ce00-df63-11eb-8a24-6dd5888dfafb.mov

Installation

npm install @lowkey/react-native-link-preview

or

yarn add @lowkey/react-native-link-preview

then install pods

cd ios/ && pod install

Usage

Get URL metadata

import LinkPreview from "@lowkey/react-native-link-preview";

// ...
const url = 'https://www.apple.com/ipad/';
const metadata = await LinkPreview.generate(url);

/*
console.log(metadata);
{
    title: string;
    type: string;
    url: string;
    imageURL: string;
    description: string;
}
*/

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT