grabury
grabury

Reputation: 5599

How to open the native Facebook app from a react app link?

In my react web app I have a link to share a website url on Facebook:

<Link href={`https://www.facebook.com/sharer/sharer.php?u=${this.props.shareUrl}`}>

Share on Facebook I could also use a plain html link like so

<a href={`https://www.facebook.com/sharer/sharer.php?u=${this.props.shareUrl}`}>Share on Facebook</a>

When this is clicked Safari is launched and the Facebook web page is displayed.

What would I need to do to get the native Facebook ios or android app to launch (instead of a browser) if it is installed? Could I carry on using this link or would I need to use a share button or install the Fb SDK?

Upvotes: 1

Views: 4102

Answers (1)

Adeel Iftikhar
Adeel Iftikhar

Reputation: 792

Try this one to open a Facebook app from URL. It works for me.

 Linking.openURL("fb://facewebmodal/f?href=https://www.facebook.com/FixadorPT/");

Upvotes: 1

Related Questions