JSPM

@times-components/link

0.20.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 132
  • Score
    100M100P100Q91841F
  • License BSD-3-Clause

component to handle links and navigation

Package Exports

  • @times-components/link

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@times-components/link) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Link Component

This component wraps its children to make them clickable and turn them into hyperlinks for web.

How to use

import Link, { TextLink } from "@times-components/link";

// works with block elements
<Link url="https://thetimes.co.uk" onPress={doSomeNavigation(url)}>
  <View style={{ width: 100, height: 100, backgroundColor: "pink" }} />
</Link>

// and also with inline text
<TextLink url="https://thetimes.co.uk/" onPress={doSomeNavigation(url)}>
  The Times
</TextLink>

Typically, apps will need to use the onPress callback to bubble up navigation so that the parent native Activity or UIViewContoller can handle the navigation, rather than multiple Activities or UIViewContollers mistakingly navigating multiple times in native land.