🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

react-native-hyperlinks

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-hyperlinks

A simple and customizable library to display hyperlinks in React Native

1.0.4
latest
Source
npm
Version published
Weekly downloads
16
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Features ✨

  • 🛑 Automatic detection for links, mentions and hashtags
  • 🔤 Full unicode support
  • 🌐 International domains support
  • 💅 Custom hyperlink style
  • ⚙️ Custom linkify-it instance
  • 📦 Tiny
  • 🚀 Created with Typescript
Without this library vs with this library

About 🗞️

Uses linkify-it under the hood. Created for my social network app, Drakkle

Installation ⚙️

yarn add react-native-hyperlinks linkify-it

Usage 🔨

import React from "react";
import { Linking } from "react-native";
import Hyperlinks from "react-native-hyperlinks";

export default function App() {
  function handleOnLinkPress(link: string) {
    console.log(link)
  }

  function handleOnMentionPress (username: string) {
    console.log(username)
  }

  function handleOnHashtagPress (tag: string) {
    console.log(tag)
  }

  return (
    <Hyperlinks
      text="Hello!! @andresribeiro #hi https://duck.com aaaaa"
      style={{ fontSize: 18 }}
      hyperlinkStyle={{ color: 'purple' }}
      onLinkPress={handleOnLinkPress}
      onMentionPress={handleOnMentionPress}
      onHashtagPress={handleOnHashtagPress}
    />
  );
}

Props ✍️

PropertyDefaultTypeRequired
textundefinedstringtrue
hyperlinkStyleundefinedStyleProp<TextStyle>false
autoDetectMentionstruebooleanfalse
autoDetectHastagstruebooleanfalse
customHyperlinksundefinedCustomHyperlink[]false
onLinkPressundefined(link: string) => unknownfalse
onMentionPressundefined(username: string) => unknownfalse
onHashtagPressundefined(tag: string) => unknownfalse
onCustomHyperlinkPressundefined(hyperlink: CustomHyperlink) => unknownfalse
linkifylinkifyIt()linkifyIt.LinkifyItfalse

Keywords

react-native

FAQs

Package last updated on 05 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts