@ss-abhishek/inapp-react-native
v0.1.1
Published
SurveySensum In-App Surveys SDK for React Native
Readme
SurveySensum In-App React Native SDK
React Native SDK to display SurveySensum in-app surveys in your app.
Installation
npm install @surveysensum/inapp-react-native
# or
yarn add @surveysensum/inapp-react-nativePeer dependencies (install if not already present):
- react, react-native
- react-native-webview
- @react-native-async-storage/async-storage
- react-native-image-picker
- react-native-toast-message
Setup
- Configure base URL subdomain and tokens at app start:
import { BaseUrlManager, TokenManager } from '@surveysensum/inapp-react-native';
BaseUrlManager.setSubdomain('your-subdomain');
TokenManager.setTokens(['YOUR_TOKEN']);- Prepare a place to render the WebView screen via callback:
import Ssinappreactnative, { WebViewLauncherScreen } from '@surveysensum/inapp-react-native';
Ssinappreactnative.setWebViewCallback((surveyData) => {
// Render WebViewLauncherScreen in your navigation/modal
// e.g. set state that shows a component:
// <WebViewLauncherScreen {...surveyData} />
});- Open the survey:
await Ssinappreactnative.openWebView('https://example.com', {
urlMatcher: 'screen://home',
});API
- BaseUrlManager, ContactManager, MetaDataManager, TokenManager
- Ssinappreactnative.openWebView(fallbackUrl, options)
- WebViewLauncherScreen React component
Building locally
npm run buildPublishing
- Update version in package.json
- Ensure
npm login - Publish:
npm publish --access publicNotes
- For React Native environments lacking
URL, ensure a polyfill if needed. - Avoid logging sensitive tokens in production.
