0.1.2 • Published 7 months ago

@harshpatel2125/react-native-link-preview v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

React Native Link Preview

npm build Maintainability Test Coverage type-coverage

Fully customizable preview of the URL extracted from the provided text.

Getting Started

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

Usage

import { LinkPreview } from '@flyerhq/react-native-link-preview'
// ...
return (
  <LinkPreview text='This link https://github.com/flyerhq can be extracted from the text' />
)

Props

Required

NameTypeDescription
textstringText to extract the link from

Optional

NameTypeDescription
containerStyleViewStyleTop level container style
enableAnimationbooleanEnables LayoutAnimation
headerstringText above the link
metadataContainerStyleViewStyleTitle, description and minimized image container style
metadataTextContainerStyleViewStyleTitle and description container style
onPreviewDataFetched(PreviewData) => voidCallback to get the fetched preview data
previewDataPreviewDataData to render instead of parsing the provided text
renderDescription(string) => ReactNodeCustom description render prop
renderHeader(string) => ReactNodeCustom header render prop
renderImage(PreviewDataImage) => ReactNodeCustom image render prop
renderLinkPreview({ aspectRatio?: number, containerWidth: number, previewData?: PreviewData }) => ReactNodeCustom render prop
renderMinimizedImage(PreviewDataImage) => ReactNodeCustom minimised image render prop
renderText(string) => ReactNodeCustom provided text render prop
renderTitle(string) => ReactNodeCustom title render prop
requestTimeoutnumberTimeout after which request to get preview data should abort
textContainerStyleViewStyleText, title, description and minimized image container style
touchableWithoutFeedbackPropsTouchableWithoutFeedbackPropsTop level touchable props

License

MIT