Get Started Component

The GetStarted component is a part of the Quest Labs React SDK. It provides a quick start guide for users to explore and engage with Application.

Components Visuals

To unlock early access to the component Get Access

Installation

To install the Quest react-native-sdk into your project, follow these steps:

  • Open your terminal/command prompt.

  • Navigate to your project's root directory using the cd command if you're not already there.

  • Run the following command to install the quest-sdk package using npm:

npm install @questlabs/react-native-sdk

This command will download and install the package and its dependencies into your project.

Make sure your project has npm and Node.js installed, and that you have the necessary permissions to install packages in your project directory.

Usage

Root Component

  • Import the QuestProvider Component: Import the QuestProvider component from the @questlabs/react-sdk package.

import { QuestProvider } from '@questlabs/react-sdk';
  • Pass the Required Props: Pass the required props to the QuestProvider. The required props are apiKey, apiSecret, entityId and authenticationToken.

Component Usage

To integrate the GetStarted component into your React native application, follow these steps.

  • Import useGetStarted Hook: Import the useGetStarted component from the @questlabs/react-sdk package.

  • Import the GetStarted Component: Import the GetStarted component from the @questlabs/react-sdk package.

  • Pass the Required Props: Pass the required props to the useGetStarted. The required props are questId, questUserId, and questToken or if user don't have quest User id then they can pass own userId to get questUserId and Token.

import { useGetStarted, GetStarted } from "@questlabs/react-native-sdk";

Don't not use QuestProvider and useGetStarted Hook in same file.

Props of GetStarted Component

The GetStarted component accepts the following props.

Props NameTypeRequireDetails

questId

string

optional

not need in offline mode.

questUserId

string

optional

not need in offline mode.

questToken

string

optional

not need in offline mode.

showDetailed

boolean

optional

show detaile mode.

onClose

Function

optional

Create the function for onClose.

isModal

boolean

optional

Open as Modal.

actions

ICriteria[]

Require

in offline user need to provide the require filed data.

sessionId

string

optional

loading

boolean

optional

don't use in offline mode.

title

string

Require

Component title.

description

string

Require

Component Descroption.

onClick

Funtion

optional

when it offline the create own Funtion.

isOffline

boolean

optional

for verification.

Style Props

Props NameTypeRequireDetails

cardHeaderText

TextStyle

optional

Card Header Text Style

startNowButtonView

ViewStyle

optional

Start Button View Style

headerText

TextStyle

optional

Main Header Text Style

mainView

ViewStyle

optional

Main View Style

cardView

ViewStyle

optional

Card View Style

buttonView

ViewStyle

optional

Buttons VIew Style

cardDesciptionText

TextStyle

optional

Card description Text style

startNowButton

TextStyle

optional

Start button text style

descriptionText

TextStyle

optional

Description Text Style

progressBarTextStyle

TextStyle

optional

Progress Bar text style

progressBar

ViewStyle

optional

Progress bar style

progressBarInnerStyle

ViewStyle

optional

Progress bar fill style

visitWebButtonView

ViewStyle

optional

Visit web Button style

visitWebButton

TextStyle

optional

Visit web button text style

footerView

ViewStyle

optional

Footer view Style

Example Usage

App.js

import { SafeAreaView, StyleSheet, StatusBar } from "react-native";
import React, { useState } from "react";
import { QuestProvider } from "@questlabs/react-native-sdk";
import DemoComponent from "./DemoComponent";

export default function App() {
return (
    <SafeAreaView style={styles.container}>
      <StatusBar />
      <QuestProvider
        apiKey="Your-Api-Key"
        apiSecret="Your-Api-Secret"
        entityId="Your-Api-entityId"
        authenticationToken="Your-authentication-token"  >
        
        <DemoComponent />
        
        </QuestProvider>
   
    </SafeAreaView>
  );
}

DemoComponent.tsx

import React from "react";
import {GetStarted,useGetStarted} from "@questlabs/react-native-sdk";
const DemoComponent = () => {
  // const getStarted = useGetStarted({
  //   questId: "Your-Quest_ID" ,
  //   userId:"5235trfet365try67ywry5"
  //   })

  const getStarted = useGetStarted({
    questId: "Your-Quest_ID" ,
    questUserId: "Your-user-id",
    questToken: "Your-Token-id" 
    });
  return (
    <>
      <GetStarted
        actions={getStarted.actions}
        description={getStarted.description}
        loading={getStarted.loading}
        questId={getStarted.questId}
        title={getStarted.title}
        questToken={getStarted.questToken}
        questUserId={getStarted.questUserId}
        showDetailed={true}
        sessionId={getStarted.sessionId}
      />

      {/* <GetStarted
        actions={[
          {
            actionId: "123",
            completed: false,
            description: 'first description',
            imageUrl: "url",
            postlink: "https://google.com",
            title: 'first title',
            buttonText: 'start',
            demoButtonText: 'demo visit',
            demoLink: "https://zoho.com"
          },
          {
            actionId: "456",
            completed: false,
            description: '2nd description',
            imageUrl: "url",
            postlink: "https://facebook.com",
            title: '2nd title',
            buttonText: 'facebook',
            demoButtonText: 'demo visit',
            demoLink: "https://clickup.com"
          },

        ]}
        description='offline coponent'
        title="offline getstarted comoponent"
        isOffline={true}
        showDetailed={true}
        onClick={() => console.log("create your own verifiy funtion")}
        onClose={() => console.log("cerate close funtion")}
      /> */}
    </>
  );
};
export default DemoComponent;

Demo

Last updated