UNPKG

react-native-hyperlinks

Version:

A simple and customizable library to display hyperlinks in React Native

23 lines (22 loc) 988 B
/// <reference types="react" /> import { StyleProp, TextProps, TextStyle } from "react-native"; import linkifyIt from "linkify-it"; export type CustomHyperlinkData = any; export type CustomHyperlink = { start: number; end: number; data?: CustomHyperlinkData; }; export type HyperlinksProps = TextProps & { text: string; hyperlinkStyle?: StyleProp<TextStyle>; autoDetectMentions?: boolean; autoDetectHastags?: boolean; customHyperlinks?: CustomHyperlink[]; linkify?: linkifyIt.LinkifyIt; onLinkPress?: (link: string) => unknown; onMentionPress?: (username: string) => unknown; onHashtagPress?: (tag: string) => unknown; onCustomHyperlinkPress?: (hyperlink: CustomHyperlink) => unknown; }; export default function Hyperlinks({ text, hyperlinkStyle, autoDetectMentions, autoDetectHastags, customHyperlinks, linkify, onLinkPress, onMentionPress, onHashtagPress, onCustomHyperlinkPress, style, ...textProps }: HyperlinksProps): JSX.Element;