Linking

Linking gives you a general interface for securely opening external URLs from JavaScript.

TV relevance: Baseline React Native Web API. Behavior depends on the TV browser/host platform policy (for example popup restrictions and supported URL schemes on Tizen/webOS).

import { Linking } from 'react-native';

API

Static methods

canOpenURL (url?: string) => Promise<boolean>

Returns a Promise<boolean>. On web this currently resolves true and should not be treated as a definitive capability check for TV browser environments.

getInitialURL () => Promise<string>

Returns a Promise that resolves to the page URL that initially loaded the app (window.location.href).

openURL (url, target) => Promise<>

Attempts to open url via window.open(url, target, 'noopener') (or window.location for tel: URLs). If target is omitted, _blank is used. Success and failure remain subject to browser and host-platform policy.


Examples

  For TV Examples: LRUD navigation is already enabled in this sandbox. Use your keyboard arrow keys to move focus.

Updated
React Native Web for TVPortions Copyright © Nicolas Gallagher, Meta Platforms, Inc., Facebook, Inc. and affiliates, and other contributors as noted in file headers and THIRD_PARTY_NOTICES.md. Modifications and TV extensions Copyright © Harpreet Singh and contributors.