Carousel

The Carousel component is a user interface element that enables the display of multiple items in a horizontally scrollable format. It is often used for showcasing products, features, or announcements.

Component Visuals

To unlock early access to the component Get Access

In this video, you'll learn:

  1. How to use the component.

  2. Customization options for the Carousel component.

Installation

To install the Quest react-native-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.


Props of Login Component

The Carousel component accepts the following props

Prop NameTypeRequiredDetails

data

ItemType

requried

The Data for items for the carousel

mainView

ViewStyle

optional

The BackGround View of the Carousel.

dotStyle

ViewStyle

optional

The dot Style of the Carousel.

dotViewStyle

ViewStyle

optional

The dot View Style.

detailsTextStyle

TextStyle

optional

The details Text Style of the Component.

detailViewStyle

ViewStyle

optional

The details Text View Style of the Component.

headerTextStyle

TextStyle

optional

The header Text Style of the Component.

headerViewStyle

ViewStyle

optional

The header View Style of the Component.

imageStyle

imageStyle

optional

The Image Style of the Component.

imageViewStyle

ViewStyle

optional

The Image View Style of the Component.

componentViewStyle

ViewStyle

optional

The Carousel Component Style.

innerViewStyle

ViewStyle

optional

The Back Ground style Of the Carousel Component.

// Types
type ItemType = {
  id: number;
  image: string | any;
  title: string;
  details: string;
  onPress?: () => void;
};

Usage

To integrate the Carousel component into your React application, follow these steps

  • Import the Carousel Component: Import the Tutorial component from the @questlabs/react--native-sdk package.

import { Carousel } from "@questlabs/react-native-sdk";

Example Usage

Here's an example of how to use the Daily Visit Streak component within your React Native application.

import { SafeAreaView, StyleSheet } from "react-native";
import React from "react";
import { Carousel} from "@questlabs/react-native-sdk";

export default function App() {
  return (
 <SafeAreaView style={styles.container}>
      <Carousel
        componentViewStyle={{ backgroundColor: "white", borderWidth: 1 }}
        data={[
          {
            id: 1,
            image:
              "https://cdn.pixabay.com/photo/2018/03/21/07/16/learning-3245793_1280.jpg",
            title: "number 1",
            details: "NUmber 1 ki details",
          },
          {
            id: 2,
            image:
              "https://cdn.pixabay.com/photo/2018/03/21/07/16/learning-3245793_1280.jpg",
            title: "number 2",
            details: "NUmber 2 ki details",
          },
          {
            id: 3,
            image:
              "https://cdn.pixabay.com/photo/2018/03/21/07/16/learning-3245793_1280.jpg",
            title: "number 3",
            details: "NUmber 3 ki details",
          },
          {
            id: 4,
            image:
              "https://cdn.pixabay.com/photo/2018/03/21/07/16/learning-3245793_1280.jpg",
            title: "number 4",
            details: "NUmber 4 ki details",
          },
          {
            id: 5,
            image:
              "https://cdn.pixabay.com/photo/2018/03/21/07/16/learning-3245793_1280.jpg",
            title: "number 5",
            details: "NUmber 5 ki details",
          },
          {
            id: 6,
            image:
              "https://cdn.pixabay.com/photo/2018/03/21/07/16/learning-3245793_1280.jpg",
            title: "number 6",
            details: "NUmber 6 ki details",
          },
          {
            id: 7,
            image:
              "https://cdn.pixabay.com/photo/2018/03/21/07/16/learning-3245793_1280.jpg",
            title: "number 7",
            details: "NUmber 7 ki details",
          },
        ]}
      />
    </SafeAreaView>
  
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "lightgray",
    justifyContent: "center",
  },
});

The above example not uses all the props.

Last updated