Giter Club home page Giter Club logo

saad-bashar / surveysparrow-react-native-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from surveysparrow/surveysparrow-react-native-sdk

0.0 1.0 0.0 56.52 MB

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.

License: MIT License

Shell 0.87% JavaScript 8.58% Objective-C 26.19% TypeScript 54.13% Ruby 9.62% C 0.60%

surveysparrow-react-native-sdk's Introduction

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.2.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

parameter Description Default Optional
domain survey domain to load value has to be provided no
token survey token for the survey value has to be provided no
surveyType survey type for the survey value has to be provided no
customParams any custom params to be passed for the survey [] yes
thankYouPageTimeLimit how long the full view has to be shown before closing 3000 (ms) yes

2) scheduleSurveySparrow()

This method will be used to schedule Survey from SurveySparrow

parameter Description Default Optional
domain survey domain to load value has to be provided no
token survey token for the survey value has to be provided no
surveyType survey type for the survey value has to be provided no
customParams any custom params to be passed for the survey [] yes
thankYouPageTimeLimit how long the full view has to be shown before closing 3000 (ms) yes
alertTitle dialouge box alert title 'Rate us' yes
alertMessage dialouge box alert message 'Share your feedback and let us know how we are doing' yes
alertPositiveText dialouge box positive text 'Rate Now' yes
alertNegativeText dialouge box negative text 'Later' yes
startAfter after how long the initial schedule has to happen 259200000 yes
repeatInterval after how long the schedule should repeat 432000000 yes
repeatSurvey if the schedule should repeat false yes
incrementalRepeat if schedule has to be a incremental repeat false yes

3) clearSurveySparrow()

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

parameter Description Default Optional
domain survey domain to load value has to be provided no
token survey token for the survey value has to be provided no

Event Listener

1) onSurveyResponseListener

Listener name Description Optional
onSurveyResponse this event listener will be triggered after completing the survey yes

Component

1) SurveySparrow

This Component can be used to render a survey view

prop Description Default Optional
config survey config such as domain,token,surveyType,customParams config object has to be provided no
onSurveyComplete callback function that will be called after survey complete null yes
styles component styles null yes

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.

surveysparrow-react-native-sdk's People

Contributors

hemanath-ss avatar ss-cmbalaji avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.