轻松链接到React Native中的其他应用程序

网友投稿 902 2025-05-28 21:25:44

轻松链接到React Native中的其他应用程序

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.

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: { appStoreId: '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!

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:服务权限数字化管理工具,简化你的工作流程
下一篇:mysql5.7如何修改密码
相关文章