0.1.10 • Published 4 months ago

surveysparrow-react-native-sdk v0.1.10

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

surveysparrow-react-native-sdk

SurveySparrow React Native SDK enables you to collect feedback from your mobile app. Embed the Classic, Chat & NPS surveys in your React Native application seamlessly with few lines of code.

Features

  1. Fully customizable pre-build Full Size View to take feedback whenever & wherever you want.
  2. Survey Component to integrate the feedback experience anywhere in your app.
  3. Schedule Surveys to take one-time or recurring feedbacks.

Installation

npm install surveysparrow-react-native-sdk

yarn add surveysparrow-react-native-sdk

IOS

Add SurveySparrow IOS sdk in pod file and run pod install

pod 'SurveySparrowSdk', :git => 'https://github.com/surveysparrow/surveysparrow-ios-sdk.git', :tag => '0.3.0'

ANDROID

Android doesn't require any changes and note the min sdk version should be 19

Usage

import {
  SurveySparrow,
  invokeSurveySparrow,
  onSurveyResponseListener,
  scheduleSurveySparrow,
  clearSurveySparrow,
} from 'surveysparrow-react-native-sdk';

// Embedded Survey
<SurveySparrow
  styles={styles.box}
  config={{
    domain: 'domain-name',
    token: 'survey-token',
    surveyType: 'classic',
    customParams: [
      { name: 'testname', value: 'custom value 10' },
      { name: 'testname2', value: 'custom value 2' },
    ],
  }}
  onSurveyComplete={(data) => {
    console.log('survey response from embed survey is', data);
  }}
/>
//  Full Survey
<Button
  title="Open Survey"
  onPress={() => {
    invokeSurveySparrow({
      domain: 'domain-name',
      token: 'survey-token',
      surveyType: 'classic',
    });
  }}
/>

// Schedule Survey
<Button
  title="Open Survey"
  onPress={() => {
    scheduleSurveySparrow({
      domain: 'domain-name',
      token: 'survey-token',
      surveyType: 'classic',
    });
  }}
/>

// clear schedule
<Button
  title="Open Survey"
  onPress={() => {
    clearSurveySparrow({
      domain: 'domain-name',
      token: 'survey-token',
      surveyType: 'classic',
    });
  }}
/>

// listining to survey complete event
React.useEffect(() => {
  const sub = onSurveyResponseListener.addListener(
    'onSurveyResponse',
    (data: any) => {
      console.log('survey response is', data);
    }
  );
  return () => sub.remove();
}, []);

Methods

1) invokeSurveySparrow()

This method will be used to invoke Survey from SurveySparrow

parameterDescriptionDefaultOptional
domainsurvey domain to loadvalue has to be providedno
tokensurvey token for the surveyvalue has to be providedno
surveyTypesurvey type for the surveyvalue has to be providedno
customParamsany custom params to be passed for the survey[]yes
thankYouPageTimeLimithow long the full view has to be shown before closing3000 (ms)yes

2) scheduleSurveySparrow()

This method will be used to schedule Survey from SurveySparrow

parameterDescriptionDefaultOptional
domainsurvey domain to loadvalue has to be providedno
tokensurvey token for the surveyvalue has to be providedno
surveyTypesurvey type for the surveyvalue has to be providedno
customParamsany custom params to be passed for the survey[]yes
thankYouPageTimeLimithow long the full view has to be shown before closing3000 (ms)yes
alertTitledialouge box alert title'Rate us'yes
alertMessagedialouge box alert message'Share your feedback and let us know how we are doing'yes
alertPositiveTextdialouge box positive text'Rate Now'yes
alertNegativeTextdialouge box negative text'Later'yes
startAfterafter how long the initial schedule has to happen259200000yes
repeatIntervalafter how long the schedule should repeat432000000yes
repeatSurveyif the schedule should repeatfalseyes
incrementalRepeatif schedule has to be a incremental repeatfalseyes

3) clearSurveySparrow()

This method will be used to clear the schedule that was previously set

parameterDescriptionDefaultOptional
domainsurvey domain to loadvalue has to be providedno
tokensurvey token for the surveyvalue has to be providedno

Event Listener

1) onSurveyResponseListener

Listener nameDescriptionOptional
onSurveyResponsethis event listener will be triggered after completing the surveyyes

Component

1) SurveySparrow

This Component can be used to render a survey view

propDescriptionDefaultOptional
configsurvey config such as domain,token,surveyType,customParamsconfig object has to be providedno
onSurveyCompletecallback function that will be called after survey completenullyes
stylescomponent stylesnullyes

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Please submit bugs/issues through GitHub issues we will try to fix it ASAP.

0.1.10

4 months ago

0.1.8

5 months ago

0.1.7

7 months ago

0.1.9

5 months ago

0.1.4

1 year ago

0.1.6

12 months ago

0.1.5

1 year ago

0.1.2

1 year ago

0.1.3

1 year ago

0.1.1

2 years ago