Challenges Component
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 useChallenges
component into your React native application, follow these steps.
Import useQuestList Hook: Import the
useChallenges
component from the@questlabs/react-sdk
package.Import the Challenges Component: Import the
Challenges
component from the@questlabs/react-sdk
package.Pass the Required Props: Pass the required props to the
useChallenges
. The required props arequestId
,questUserId
, andquestToken
or if user don't have quest User id then they can pass own userId to get questUserId and Token.
import { useChallenges , Challenges } from "@questlabs/react-native-sdk";
Props of Challenges Component
The Challenges component accepts the following props
actions
ICriteria[]
Require
in offline user need to provide the require filed data.
loading
boolean
Optional
don't use in offline mode.
template
"basic" | "detail"
Optional
For change the template (template2)
title
string
Optional
Title for list.
header
string
Optional
Header text for component.
Styles Props
mainModalContainer
ViewStyle
Optional
Style for outter modal style
mainViewStyle
ViewStyle
Optional
Main View Styles
headerTextStyle
TextStyle
Optional
Header Text Style
iconBackgroundView
ViewStyle
Optional
Icon Background View
questionBackgroundViewStyle
ViewStyle
Optional
Question Background View Style
questionHeaderTextStyle
TextStyle
Optional
Question header text style
footerViewStyle
ViewStyle
Optional
Footer view style
footerTextStyle
TextStyle
Optional
Footer Text Style
progressBarTextStyle
TextStyle
Optional
Progress bar text style
progressBar
ViewStyle
Optional
Progress bar outter bar stlye
progressBarInnerStyle
ViewStyle
Optional
Progress bar inner style
searchInput
ViewStyle
Optional
Search input view stlye
listItemView
ViewStyle
Optional
List item view style
listItemTitle
TextStyle
Optional
list item title text style
listItemDescription
TextStyle
Optional
List item description style
imageView
ViewStyle
Optional
Image view style
itemTitle
TextStyle
Optional
Item title text 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"
fontFamily= "Your-Font-FamFamily"
>
<DemoComponent />
</QuestProvider>
</SafeAreaView>
);
}
DemoComponent.tsx
import React from "react";
import {chellenges,useChallenges} from "@questlabs/react-native-sdk";
const DemoComponent = () => {
// const chellenges= useChallenges({
// questId: "Your-Quest_ID" ,
// userId:"5235trfet365try67ywry5"
// })
const chellenges= useChallenges({
questId: "Your-Quest_ID" ,
questUserId: "Your-user-id",
questToken: "Your-Token-id"
});
return (
<>
<Challenges
actions={chellenges.actions}
// actions={[
// {
// actionId: "123",
// completed: false,
// isLocked: false,
// metricCount: "23",
// progressData: 12,
// progressPercent: 10,
// title: "first",
// },
// {
// actionId: "456",
// completed: false,
// isLocked: true,
// metricCount: "23",
// progressData: 12,
// progressPercent: 40,
// title: "first",
// },
// {
// actionId: "532",
// completed: false,
// isLocked: true,
// metricCount: "23",
// progressData: 12,
// progressPercent: 80,
// title: "first",
// },
// {
// actionId: "342",
// completed: false,
// isLocked: true,
// metricCount: "23",
// progressData: 12,
// progressPercent: 100,
// title: "first",
// },
// ]}
title="my list"
header="Somting"
// loading={chellenges.loading}
template="basic"
/>
</>
);
};
export default DemoComponent;
Demo
Last updated