Code Monkey home page Code Monkey logo

react-native-app-link's Introduction

Logo

react-native-app-link

Easily deep link to other apps in React Native. If the app isn't installed on the user's phone, open the App Store or Play Store link instead.


NPM version badge

Example GIF

Installation:

npm i -S react-native-app-link

Usage:

import AppLink from 'react-native-app-link';

AppLink.maybeOpenURL(url, { appName, appStoreId, appStoreLocale, playStoreId }).then(() => {
  // do stuff
})
.catch((err) => {
  // handle error
});

AppLink.openInStore({ appName, appStoreId, appStoreLocale, playStoreId }).then(() => {
  // do stuff
})
.catch((err) => {
  // handle error
});

API:

maybeOpenURL(url, config) -> Promise Opens link if app is present. If not, it opens an app store to prompt the user to download it.

url: (String) a url in the specified app's deep linking format that points to the content you want to open.

config: (Object) a set of fallback urls if the app requested does not exist locally.

config.appName: (String) the app's name you're linking into.

config.appStoreId: (String) the app's ID on the App Store (iOS). Example: { appStoreId: '529379082' }

config.appStoreLocale: (String) the App Store's locale (iOS). Defaults to the USA App Store. Example: { appStoreId: 'us' }

config.playStoreId: (String) the app's package identifier on the Play Store (Android). Example: { playStoreId: 'me.lyft.android' }


openInStore(config) -> Promise Opens an app store to the listing requested.

config: (Object) a config for generate store urls.

config.appName: (String) the app's name you're linking into.

config.appStoreId: (String) the app's ID on the App Store (iOS). Example: { appStoreId: '529379082' }

config.appStoreLocale: (String) the App Store's locale (iOS). Defaults to the USA App Store. Example: { appStoreLocale: 'us' }

config.playStoreId: (String) the app's package identifier on the Play Store (Android). Example: { playStoreId: 'me.lyft.android' }

If there are any issues file an issue above and don't hesitate to spin up a PR and contribute!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.