Quest List Component

A versatile UI element for managing and tracking task completion. Displays tasks, tracks progress with a progress bar, and shows checkmarks for completed tasks.

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 QuestList component into your React native application, follow these steps.

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

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

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

import { useQuestList , QuestList } from "@questlabs/react-native-sdk";

Don't not use QuestProvider and useQuestList Hook in same file

Props of QuestList Component

The QuestList component accepts the following props

Props NameTypeRequireDetails

questId

string

optional

The unique identifier for the tutorial or quest.

questUserId

string

optional

The unique identifier of the user.

userToken

string

optional

An authentication token or API key necessary for accessing tutorial or quest data.

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.

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.

campaignVariationId

string

optional

Id For verification.

onError

Function

optional

For Showing the Error.

showFooter

boolean

optional

user Want to show the footer or not

styleConfig

object

optional

An object containing Styling properties for styling various components within the get started process, including form, topbar, headings, descriptions, and buttons.

Style Props

styleConfig {
  Form?: ViewStyle;
  Heading?: TextStyle;
  Description?: TextStyle;
  Footer?: {
    FooterStyle?: ViewStyle;
    FooterText?: TextStyle;
    FooterIcon?: TextStyle;
  };
  Card?: {
    title?: TextStyle;
    description?: TextStyle;
    stepText?: TextStyle;
  };
  TopBar?: ViewStyle;
}

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 {questList,useQuestList} from "@questlabs/react-native-sdk";
const DemoComponent = () => {
  // const questList= useQuestList({
  //   questId: "Your-Quest_ID" ,
  //   userId:"5235trfet365try67ywry5"
  //   })

  const questList= useQuestList({
    questId: "Your-Quest_ID" ,
    questUserId: "Your-user-id",
    questToken: "Your-Token-id" 
    });
  return (
   <>
      <QuestList
        campaignVariationId={questList.campaignVariationId}
        // actions={questList.actions}
        actions={[
          {
            actionId: '123',
            completed: false,
            title: "First",
            description: "First discription",
            link: "https://google.com"

          },
          {
            actionId: '456',
            completed: false,
            title: "First",
            description: "First discription",
            link: "https://google.com"

          },
          {
            actionId: '789',
            completed: false,
            title: "First",
            description: "First discription",
            link: "https://google.com"

          },
          {
            actionId: '342',
            completed: false,
            title: "First",
            description: "First discription",
            link: "https://google.com"

          },
          {
            actionId: '4523',
            completed: false,
            title: "First",
            description: "First discription",
            link: "https://google.com"

          },
          {
            actionId: '5342',
            completed: false,
            title: "First",
            description: "First discription",
            link: "https://google.com"

          },
          {
            actionId: '1234',
            completed: false,
            title: "First",
            description: "First discription",
            link: "https://google.com"

          },
          {
            actionId: '3253',
            completed: false,
            title: "First",
            description: "First discription",
            link: "https://google.com"

          }
        ]}
        description={questList.description}
        title={questList.title}
        loading={questList.loading}
        questId={questList.questId}
        userToken={questList.userToken}
        questUserId={questList.questUserId}
        // showFooter={false}
        // onError={(err) => console.log(err)}
        // styleConfig={questList?.styleConfig}
        styleConfig={{
          Form: {
            backgroundColor: "lightgray"
          },
          TopBar: { backgroundColor: "orange" },

          Card: {
            title: {
              color: "yellow",

            },
            description: {
              color: "red"
            },
            stepText: {
              color: "blue"
            }
          }
        }}

      />
    </>
  );
};
export default DemoComponent;

Demo

Last updated