react-native-dt-sdk
This repository contains all the sources of dropthought SDK for react-native
Latest version
Features
- Picture Choice
- Matrix choice
- Multiple open question
- Matrix rating
- Dropdown
- Rating slider
- Ranking
Requirement
- react-native version above 0.64.1
Installation
Using npm:
npm install @dropthought/react-native-dt-sdk
or using yarn:
yarn add @dropthought/react-native-dt-sdk
Installing dependencies
yarn add react-native-aes-crypto react-native-secure-key-store react-native-safe-area-context@^3.0.7 lottie-react-native@5.1.6 react-native-image-picker@7.0.1
initialize
To initialize Dropthought SDK with your apiKey & preferred storage. You can put the code inside the index.js
import {
SurveyModalContainer,
initialize,
} from '@dropthought/react-native-dt-sdk';
initialize({
apiKey: 'YOUR_API_KEY',
storage: AsyncStorage,
});
<SurveyModalContainer>{/* Your components */}</SurveyModalContainer>;
Note: You can find you API key on the web dashboard. (If you don't have permission, please contact your admin)
Open survey screen
Declare
const openSurvey = useOpenSurvey() and use openSurvey whenever you need to open the survey screen.
import { useOpenSurvey } from '@dropthought/react-native-dt-sdk';
const onButtonPress = () => {
const openSurvey = useOpenSurvey();
openSurvey({
visibilityId: 'YOUR_VISIBILITY_ID',
});
};
Note: You can find and copy your visibility ID here in Enterprise app
Additional features
- Set survey metadata
import { useOpenSurvey } from '@dropthought/react-native-dt-sdk';
const onButtonPress = () => {
const openSurvey = useOpenSurvey();
const metadata = { name: 'barney', age: '36' };
openSurvey({
visibilityId: 'YOUR_VISIBILITY_ID',
metadata: metadata,
});
};
- Upload offline feedbacks
Dropthought SDK will cache user's feedbacks if there has no network connection. You can call this function and we will check if there's any cached feedbacks and submit them again.
When user finishes a survey under no network or a bad network, the survey feedback is saved offline. Dropthought SDK will try to upload the offline feedbacks(if any) when app start.
Or, you could call
feedbackUploader.upload()
manually to try to upload the saved results once if your app has network status monitor.
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT