The Leaderboard component efficiently displays and manages leaderboards in React, offering customizable styling. Users can easily monitor progress and compete through its clear interface.
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:
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.
Pass the Required Props: Pass the required props to the QuestProvider. The required props are apiKey, entityId,authenticationToken and fontFamily.
To load external fonts, please refer this doc to setup expo-font on your expo app.
Component Usage
To integrate the useLeaderboard component into your React native application, follow these steps.
Import useLeaderboard Hook: Import the useLeaderboard component from the @questlabs/react-sdk package.
Import the Leaderboard Component: Import the Leaderboard component from the @questlabs/react-sdk package.
Pass the Required Props: Pass the required props to the useLeaderboard. The required props are questUserId, and userToken or if user don't have quest User id then they can pass own userId to get questUserId and Token.
Don't not use QuestProvider and useLeaderboard Hook in same file
Props of Leaderboard Component
The Leaderboard component accepts the following props
Props Name
Type
Require
Details
leadersData
ITopThree[]
Require
in offline user need to provide the require filed data.
loading
boolean
Optional
don't use in offline mode.
cardTitle
string
Optional
Title for list.
cardDescription
string
Optional
Description for list.
header
string
Optional
Header text for component.
styleConfig
object
Optional
An object containing Styling properties for styling various components within the get started process, including form, topbar, headings, descriptions, and buttons.