React Native SDK
bloclinks-rn
Official React Native SDK for deep linking and attribution.
Installation
npm install bloclinks-rn
# or
yarn add bloclinks-rn
Setup
Initialize the SDK once on app start, before navigation renders:
import BlocLinks from 'bloclinks-rn'
BlocLinks.init({
apiKey: 'bl_live_YOUR_API_KEY',
debug: __DEV__, // optional: logs to console in dev
})
Getting the deep link path
Call this after init, before your navigation renders:
const deepPath = BlocLinks.getDeepLinkPath()
// Returns: "/product/123" | "/referral/abc" | null
Full example
import { useEffect, useState } from 'react'
import BlocLinks from 'bloclinks-rn'
export default function App() {
const [initialPath, setInitialPath] = useState<string | null>(null)
useEffect(() => {
BlocLinks.init({ apiKey: 'bl_live_YOUR_API_KEY' })
const path = BlocLinks.getDeepLinkPath()
if (path) setInitialPath(path)
}, [])
return <Navigation initialPath={initialPath} />
}
API Reference
BlocLinks.init(config)apiKey: string, debug?: boolean
Initialize SDK. Call once on app start.
BlocLinks.getDeepLinkPath()Returns: string | null
Get attributed deep link path. Call after init.