npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

expo-link-preview

v1.3.2

Published

Render URL links to either a web or Twitter preview

Downloads

80

Readme

expo-link-preview

Render URL links for Web & Twitter previews

render twitter preview

Built with react-native using expo.

Installation

# yarn
yarn add expo-link-preview

# npm
npm install expo-link-preview --save

Then import with

import LinkPreview from "expo-link-preview";

Note: You may also need to install dependencies react-native-opengraph-kit and javascript-time-ago.

Usage

Example:

import { View, StyleSheet } from "react-native";
import LinkPreview from "expo-link-preview";

export default function App() {
  return (
    <View style={styles.container}>
      <LinkPreview
        link="http://github.com"
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
});

Web

Web previews will automatically use OpenGraph information to populate the preview. If an image is present, LinkPreview will default to that, otherwise show a non-interactive web view of the page.

render web preview

Twitter

Twitter previews will automatically be used if the OpenGraph response returns site_name=Twitter. The Twitter preview automatically adjusts to handle basic tweets and up to four images.

render twitter preview

Props

| Prop | Required? | Type | Description | | --- | --- | --- | ---------- | | link | true | string | The link to render the preview. Links are automatically validated, but should be passed as a string value that begins with "https://". | | onPress | false | function | The onPress function is called whenever a user taps the preview. | | containerColor | false | string | The background color of the preview container. Defaults to iOS themed component. | | borderColor | false | string | The border color of the preview container. Defaults to iOS themed component. | | titleColor | false | string | The text color of the Header – typically the website title or the Twitter user name. Defaults to iOS themed component. | | textColor | false | string | The text color of the Text – typically the website description or the Twitter user handle and tweet. Defaults to iOS themed component. |

Twitter-specific props

| Prop | Required? | Type | Description | | --- | --- | --- | ---------- | | twitterLogoColor | false | string | The tint color of the Twitter logo. Defaults to Twitter Blue. | | showLikes | false | bool | Enable/disable the Likes counter. Defaults to true. | | showRetweets | false | bool | Enable/disable the Retweets counter. Defaults to true. | | showReplies | false | bool | Enable/disable the Replies counter. Defaults to true. |

Color example

Example:

import { View, StyleSheet } from "react-native";
import LinkPreview from "expo-link-preview";

export default function App() {
  return (
    <View style={styles.container}>
      <LinkPreview
        link="http://github.com"
        containerColor={"pink"}
        titleColor={"blue"}
        textColor={"yellow"}
        borderColor={"red"}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
});

web color render

Built by Tyler J. ✌️