Onboarding Component
OnBoarding component is a versatile React Native component designed for creating interactive onboarding experiences. It allows you to guide users through a series of screens, collect their responses.
Components Visuals

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.
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 areapiKey
,entityId,
authenticationToken
andfontFamily.
Component Usage
To integrate the Onboarding
component into your React native application, follow these steps.
Import useOnboarding Hook: Import the
useOnboarding
component from the@questlabs/react-sdk
package.Import the Onboarding Component: Import the
Onboarding
component from the@questlabs/react-sdk
package.Pass the Required Props: Pass the required props to the
useOnboarding
. The required props arequestId
,questUserId
, anduserToken
or if user don't have quest User id then they can pass own userId to get questUserId and Token.
import { useOnboarding, Onboarding } from "@questlabs/react-native-sdk";
Props of Onboarding Component
The Onboarding component accepts the following props
template
"multipage" | "single" | "oneQuestion";
optional
What kind of template you need.
multipleChoice
"checkbox" | "fill";
optional
What kind of multichoice you need.
onCross
Function
optional
create the function for onCross.
onError
Function
optional
For Showing the Error.
sections
ISection[]
Require
user need to provied filled data related to the template.
questId
string
Require
Provied quest id
questUserId
string
optional
provied quest user id
userToken
string
optional
Provied quest token
actions
ICriteria[]
optional
user need to provied filled data related to the section action name.
loading
boolean
optional
don't use in offline mode.
title
string
optional
component title text
description
string
optional
component title description text.
isModal
boolean
optional
Open as Modal.
campaignVariationId
string
optional
Id For verification.
styleConfig
object
optional
An object containing Styling properties for styling various components within the get started process, including form, topbar, headings, descriptions, and buttons.
Styles Props
styleConfig {
Form?: ViewStyle;
Topbar?: ViewStyle;
Heading?: TextStyle;
Description?: TextStyle;
Input?: ViewStyle;
Label?: TextStyle;
PrimaryButton?: ViewStyle | TextStyle;
SecondaryButton?: ViewStyle | TextStyle;
MultiChoice?: {
style?: TextStyle;
selectedStyle?: ViewStyle;
};
Footer?: {
FooterStyle?: ViewStyle;
FooterText?: TextStyle;
FooterIcon?: TextStyle;
};
}
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"
fontFamily= "Your-Font-FamFamily"
>
<DemoComponent />
</QuestProvider>
</SafeAreaView>
);
}
DemoComponent.tsx
import React from "react";
import {Onboarding,useOnboarding } from "@questlabs/react-native-sdk";
const DemoComponent = () => {
// const onboarding = useOnboarding({
// questId: "Your-Quest_ID" ,
// userId:"5235trfet365try67ywry5"
// })
const onboarding = useOnboarding ({
questId: "Your-Quest_ID" ,
questUserId: "Your-user-id",
questToken: "Your-Token-id"
});
return (
<>
<Onboarding
styleConfig={{
Form: {
height: "auto",
backgroundColor: "lightgray"
},
Description: { color: "yellow" },
Footer: {
FooterIcon: { color: "red" }
},
Heading: { color: "red" },
Input: {
backgroundColor: "orange"
},
Label: { color: "blue" },
MultiChoice: {
// style: {
// color: "yellow"
// },
// selectedStyle: {
// backgroundColor: "red",
// borderColor: "black"
// }
},
}}
template="single"
onCross={() => console.log("out")}
isModal={false}
multipleChoice="fill"
questId={onboarding.questId}
questToken={onboarding.questToken}
questUserId={onboarding.questUserId}
// sections={[
// {
// name: "Details",
// criteriaNames: [
// "First name",
// "Last name",
// // "Add your address",
// "Email",
// "Gender",
// "Colors",
// ],
// },
// {
// name: "Company",
// criteriaNames: [
// "Company name",
// // "Last name",
// "Email",
// // "Gender",
// // "Colors",
// ],
// },
// {
// name: "Connection",
// criteriaNames: [
// "First name",
// "Last name",
// "Email",
// "Gender",
// "Colors",
// ],
// },
// ]}
description="THis is my Onboarding"
title="My Onboarding"
loading={onboarding.loading}
sections={[
{
criteriaNames: [
"First name",
"Last name",
"Email",
"Gender",
"Colors",
"Add your address",
"What is your company name?",
"Your hobbies?",
"What is your role in the company?",
],
},
]}
actions={[
{
actionId: "123",
actionType: "USER_INPUT_TEXT",
answer: [],
title: "First name",
},
{
actionId: "32",
actionType: "USER_INPUT_TEXT",
answer: [],
title: "Last name",
},
{
actionId: "342",
actionType: "USER_INPUT_SINGLE_CHOICE",
answer: [],
options: [1, 2, 3, 4],
title: "Gender",
},
{
actionId: "123",
actionType: "USER_INPUT_MULTI_CHOICE",
answer: [],
options: ["df5", "afg", "sdgfh", "asdg"],
title: "Colors",
},
{
actionId: "5673563",
actionType: "USER_INPUT_TEXT",
answer: [],
title: "What is your company name?",
},
]}
// actions={onboarding.actions}
/>
</>
);
};
export default DemoComponent;
Demo
Last updated