React Native hook for Linking
yarn add @rnhooks/linking
import useLinking from '@rnhooks/linking';
function App() {
const [url, openUrl, error] = useLinking();
return (
<View style={styles.container}>
<Text style={styles.welcome}>@rnhooks/linking</Text>
<Text style={styles.instructions}>Linking URL</Text>
<Text style={styles.instructions}>{url || error}</Text>
<Button title="Update" onPress={() => openUrl(URL)} />
</View>
);
}
Name | Default | Type | Description |
---|---|---|---|
url | null |
string | Linking URL |
openUrl | () => {} |
function | Open Linking URL |
error | null |
string | Error |