0

My goal is to allow users share content from the application to external world (for example Viber, Whats App etc)

Here is the code:

import {Share} from 'react-native'

Share.share({ message:  'appscheme://feeds/:feedId'})

However this link is not clickable hence is useless since cannot open the app

What about Share.share({ message: 'https://appscheme.com/feeds/:feedId'})

My goal is to achieve the same behavior as YouTube video sharing. You can press on video share, send it to anybody in chat, and then to access it right from there. For example:

enter image description here

Than you in advance!

3
  • do you want them to get a link that leads to your website/app? Commented Nov 18, 2021 at 19:46
  • I want to be able to share a clickable link which redirects to the react native app Commented Nov 18, 2021 at 21:19
  • can you share your linking config? You need to add prefixes to your linking so the device will be able to redirect to your app if one of the prefixes detected. Commented Nov 18, 2021 at 22:30

1 Answer 1

1

That is called universal link(iOS) / App Links (Android)

FYR: https://reactnative.dev/docs/linking#open-links-and-deep-links-universal-links

Getting the link opening your app:

function handleURL(url) {
    // your stuff
}

useEffect(() => {
    function addLinkingEventListener() {
        Linking.addEventListener('url', evt => {
            handleURL(evt?.url)
        })
    }

    Linking.getInitialURL()
        .then(initUrl => {
            handleURL
        })
        .catch(handleError)
        .finally(() => {
            addLinkingEventListener()
        })

    return () => {
        Linking.removeEventListener('url', handleUrlEvent)
    }
}, [])
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.