Repository navigation
v0.1.0
π v1.0.0 β First Public Release
Weβre excited to announce the first public release of react-native-preview-url π β a React Native library for displaying rich link previews using our free open-source Link Preview API.
β¨ Features
<LinkPreview /> Component β display link previews with customizable styles and layout.
useUrlPreview Hook β fetch and manage preview metadata easily in functional components.
Customizable UI with style overrides and behavior props.
Free API usage β no API key required.
π Props
This release supports the following props for <LinkPreview />:
url (string, required) β The URL to preview.
timeout (number) β Request timeout in milliseconds, default is 3000.
onSuccess (function) β Callback when metadata is fetched successfully. Receives the metadata object.
onError (function) β Callback when an error occurs. Receives the error message.
onPress (function) β Press handler for the whole preview. Defaults to opening the fetched data.url.
containerStyle (ViewStyle) β Custom style for the main container.
imageStyle (ImageStyle) β Custom style for the preview image.
imageContainerStyle (ViewStyle) β Custom style for the image wrapper.
titleStyle (TextStyle) β Custom style for the title text.
descriptionStyle (TextStyle) β Custom style for the description text.
urlStyle (TextStyle) β Custom style for the displayed domain text.
titleLines (number) β Maximum number of lines for the title. Default: 2.
descriptionLines (number) β Maximum number of lines for the description. Default: 4.
showUrl (boolean) β Whether to display the domain under the description. Default: true.
hideImage (boolean) β Whether to hide the image preview entirely. Default: false.
loaderComponent (JSX element) β Custom loader component while fetching metadata. Defaults to .
imageComponent (React component) β Custom image component to render. Defaults to .
fallbackImage (ImageSourcePropType) β Fallback image URL to use if the preview image fails to load.