Chuyển tới nội dung chính

SDK 1.0.0

Sharing and deep links

// Permission ui.share — the OS share sheet
const result = await sdk.share({ title: 'Bài hát', message: 'Nghe bài này nhé!' })
// result.action: 'sharedAction' | 'dismissedAction'

// Permission deeplink — a link that opens YOUR mini app at a path
const link = await sdk.createShareLink({ path: '/song/42' })
// → 'https://i-catholic.org/app/m/<your-app-id>/song/42'

// Permission deeplink — build the link and open the share sheet in one call
await sdk.shareContent({ path: '/song/42', title: 'Bài hát', text: 'Nghe bài này nhé!' })
  • When someone opens a share link, the app launches your mini app and passes the path as deepLinkPath in the nativeReady event. Route to it on start-up.

  • Android drops the share url. React Native's share sheet honours url on iOS only. That applies to share({ url }) and to the link shareContent attaches. If the link must reach Android users, put it in the text:

    const link = await sdk.createShareLink({ path: '/song/42' })
    await sdk.share({ message: `Nghe bài này nhé! ${link}` })
  • Note the field names: share takes message, shareContent takes text.