React Native
The React Native wrapper is a thin bridge over the native iOS and Android SDKs. Surveys render as fully native UI, no survey UI lives in JavaScript. It exposes exactly what the native SDKs expose and, like them, is fire-and-forget: calls do not report outcomes, and failures are logged natively rather than surfaced to JavaScript.
It is a Turbo Module, so it requires the New Architecture.
Installation
Section titled “Installation”yarn add react-native-whiskrkitThe native WhiskrKit SDK is a Swift package, consumed through the cocoapods-spm plugin:
gem install cocoapods-spmIn your app’s Podfile, declare the plugin and package source, and set the platform to at least iOS 17:
platform :ios, '17.0'plugin 'cocoapods-spm'
target 'YourApp' do spm_pkg "WhiskrKit", :url => "https://github.com/whiskrkit/whiskrkit-swift.git", :version => "0.1.10" # ...endThen cd ios && pod install.
Android
Section titled “Android”The eu.whiskrkit:whiskrkit-android dependency resolves from Maven Central with no extra setup. Just make sure your app’s minSdkVersion is 26 or higher.
initialize, present, and checkAndPresent are synchronous and return nothing; useWhiskrKitSurvey is a React hook. initialize must be called before the others; calls made without it are silent no-ops (logged natively). Attachment to the host app’s window happens automatically on initialize; there is no view or component to mount.
import { initialize, present, checkAndPresent, useWhiskrKitSurvey,} from 'react-native-whiskrkit';initialize(apiKey, options?)
Section titled “initialize(apiKey, options?)”Initialises the SDK and attaches WhiskrKit to your app. Call once, at startup.
initialize('wk_live_your_api_key');
// With mocked surveys for local development:initialize('any-string', { withMockedSurveys: true });| Parameter | Type | Description |
|---|---|---|
apiKey | string | Your WhiskrKit API key from the dashboard |
options? | { withMockedSurveys?: boolean } | When withMockedSurveys is true, uses local mock data instead of the API |
present(surveyId)
Section titled “present(surveyId)”Imperatively presents a survey, bypassing eligibility checks. Use for a feedback button, a push-notification handler, or any trigger you own.
present('nps-survey');| Parameter | Type | Description |
|---|---|---|
surveyId | string | The identifier of the survey to present |
checkAndPresent(surveyId)
Section titled “checkAndPresent(surveyId)”Checks eligibility and presents a survey if the user qualifies. The timing is yours; the targeting decision stays with the backend.
checkAndPresent('settings-feedback');| Parameter | Type | Description |
|---|---|---|
surveyId | string | The identifier of the survey to evaluate and potentially present |
useWhiskrKitSurvey(surveyId)
Section titled “useWhiskrKitSurvey(surveyId)”A React hook that presents a survey automatically when a component mounts. This is the wrapper’s equivalent of the native automatic presentation (SwiftUI’s .whiskrKitSurvey modifier, Jetpack Compose’s WhiskrKitSurvey): call it inside a screen component and a survey appears on that screen, subject to eligibility. Under the hood it runs checkAndPresent on mount, and again if surveyId changes.
import { useWhiskrKitSurvey } from 'react-native-whiskrkit';
function FeedbackScreen() { useWhiskrKitSurvey('nps-survey'); return <YourScreen />;}| Parameter | Type | Description |
|---|---|---|
surveyId | string | The identifier of the survey to evaluate and potentially present |
Design notes
Section titled “Design notes”Fire-and-forget, silent failure. The native SDKs never surface errors or survey lifecycle events, so neither does the wrapper: there are no promises to await, no event emitter, and no error codes. When debugging, watch the native logs: Console.app (subsystem WhiskrKit) on iOS, Logcat (tag WhiskrKit) on Android.
No theming API. Theming is native-only (SwiftUI setTheme on iOS, WhiskrKitHost(theme:) on Android) and is not exposed through the wrapper. Surveys use the SDK defaults.
Platform requirements
Section titled “Platform requirements”| Requirement | Minimum |
|---|---|
| React Native | 0.85+ (New Architecture) |
| iOS | 17.0 |
Android minSdk | 26 |