Overview
FlockSDK-React Native enables seamless integration of Flock referral and rewards into your React Native applications. Effortlessly build powerful referral programs and track customer engagement in minutes.- Identify and track users
- Present referral experiences as modals or full screen
- Handle events (close, success, invalid) in-app
- Officially supported by the Flock team
Requirements
- React Native 0.60 or later (auto-linking supported)
- iOS 13.0 or later (if targeting iOS)
- Android 6.0 (API 23) or later (if targeting Android)
- Node.js 14 or later
Installation
1. Install the Package
2. Link the Native Dependencies
Auto-linking handles native dependencies for React Native 0.60+.For iOS
- Install CocoaPods dependencies:
- Ensure your
Info.plistfile includes permissions for internet access:
For Android
Make sureAndroidManifest.xml includes the following permission:
Usage
1. Configure the SDK
Wrap your app in theFlockSDKProvider and pass the publicAccessKey and environment:
2. Identify Your User
Callidentify after your user logs in to link their identity with Flock:
3. Show a Flock Page
Placement API (Recommended)
New: UseA placement renders a Flock referral page within your app, making it easy to prompt users to share and participate in your referral program.addPlacement(placementId, options)to display a referral component. Each campaign page now has a uniqueplacementIdfor robust and future-proof integration.
- The legacy
openPage(type, options)method is now deprecated and will be removed in a future release. - Use the Placement API for all new integrations and update any usage of
openPagetoaddPlacement.
Invitee Placement
To display the invitation page for the invitee, use theaddPlacement method with the invitee placement ID:
Legacy API (Deprecated)
Deprecated:openPage(type, options)is now deprecated. UseaddPlacement(placementId, options)for all new integrations.
Why Flock?
- No UI to build – We handle the referral screens for you.
- Fully managed backend and analytics.
- Easy integration and customization.
- Official support and regular updates.
FAQ
Q: What React Native version is required? A: @wflock/react-native-sdk supports React Native 0.60 and above. Q: Can I customize WebView actions? A: Yes, you can listen to messages from the WebView and define custom follow-up actions. Q: Where can I get support? A: Contact the Flock support team at [email protected].Thank you for using Flock SDK!