Customizable Rich URL Previews in React Native Apps – RN Url Preview

Description:

RN Url Preview is a flexible React Native component that enables you to create fully customizable URL previews within their applications.

Features

  • 🎨 Fully customizable components for image, title, and description
  • 🔗 Automatic metadata fetching from provided URLs
  • 📱 Responsive layout options for various design needs
  • 🚀 Easy integration with existing React Native projects
  • 🖼️ Placeholder support for loading states

Use Cases

  • Social media apps: Display rich previews for shared links in user feeds
  • News aggregators: Provide concise article previews with thumbnails
  • Messaging platforms: Enhance URL sharing with visual previews
  • Bookmarking apps: Show website previews for saved links
  • Content curation tools: Display previews for curated content collections

Preview

RN Url Preview

How to Use It

1. Install the package:

    yarn add rn-url-preview

    2. Import the component:

      import UrlPreview from "rn-url-preview";

      3. Use the component in your JSX:

        <UrlPreview
         url="https://github.com/"
         style={{
           backgroundColor: "gainsboro",
           borderRadius: 16,
           padding: 12,
           marginVertical: 12,
           gap: 12,
         }}
        >
         <UrlPreview.Image style={{ width: "100%", height: 200, borderRadius: 12 }} />
         <UrlPreview.Title
           style={{ fontWeight: "bold", fontSize: 18, color: "blue" }}
         />
         <UrlPreview.Description />
        </UrlPreview>

        4. Available component props

        • UrlPreview: Accepts a url prop (string) and any View props
        • UrlPreview.Image: Accepts a placeholder prop (Image Source) and any Image props
        • UrlPreview.Title: Accepts a placeholder prop (string) and any Text props
        • UrlPreview.Description: Accepts a placeholder prop (string) and any Text props

        FAQs

        Q: Can I customize the order of preview elements?
        A: Yes, you have full control over the layout. You can arrange the Image, Title, and Description components in any order within the UrlPreview wrapper.

        Q: How does the library handle failed URL fetches?
        A: The library will display the placeholder content if provided. It’s a good practice to implement error handling in your app to manage cases where URL data can’t be fetched.

        Q: Is it possible to style individual elements differently for each preview?
        A: Absolutely. Each UrlPreview.Image, UrlPreview.Title, and UrlPreview.Description component accepts its own style prop, allowing for unique styling per instance.

        Q: Does this library work with SSL/HTTPS URLs?
        A: Yes, it works with both HTTP and HTTPS URLs.

          Add Comment