Socket
Socket
Sign inDemoInstall

react-native-slider-intro

Package Overview
Dependencies
0
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-slider-intro

A simple and full customizable React Native package which implements a unique slider.


Version published
Weekly downloads
129
increased by3.2%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

📲 react-native-slider-intro

npm version build platform NPM total downloads react-native-slider-intro runs with Expo Go license

A simple and full customizable React Native package which implements a unique slider.

Installation

yarn add react-native-slider-intro

or

npm install react-native-slider-intro --save

Running the example project

iOS

yarn example ios

Android

yarn example android

Usage

Basic example

import React from 'react';
import SliderIntro from 'react-native-slider-intro';

const slides = [
  {
    index: 1,
    title: 'First step',
    text: 'Simple description.',
    link: 'https://pccontroller.rnstudio.hu',
    image: require('./images/step1.png'),
    backgroundColor: '#febe29',
  },
  {
    index: 2,
    title: 'Second step',
    text: 'Simple description for the second step.',
    image: require('./images/step2.png'),
    backgroundColor: '#febe29',
  },
];

const BasicExample = ({ closeExample }: { closeExample: () => void }) => {
  return (
    <SliderIntro data={slides} onDone={closeExample} onSkip={closeExample} />
  );
};

export default BasicExample;

The package includes two render options. Besides the default render when you can pass data as an array of ISliderIntroItem props, you can use a custom render with children and numberOfSlides properties.

Properties

NameTypeDefault valueDescription
dataarray[]Default render - array of items. Children will be ignored if data is passed.
numberOfSlidesarraynumberCustom render - if children is passed, data will be ignored. numberOfSlides is required in this case.
childrenReactNodenullCustom render - JSX elements to render.
navigationBarBottomnumber0Custom value of dot navigation container bottom position
navigationBarHeightnumber70Height of dot navigation container
animateSlideSpeednumber15Speed of slider animation
navContainerMaxSizePercentnumber0.5Percent value of navigation container's width
dotWidthnumber12The radius of the 'dot' circle of navigation
fixDotOpacitynumber0.35Each dots opacity which don't have animation
fixDotBackgroundColorcolorgreyEach dots background which don't have an animation
animatedDotBackgroundColorcolorwhiteEach dots background which have an animation
animateDotSpeednumber8Speed of dot animation
animateDotBouncingnumber2The 'bounciness' value of all animations. https://reactnative.dev/docs/animated#spring
hasReactNavigationbooleanfalseThere is a trouble with backButton behaviour when you're using react-navigation. You should use useFocusEffect in this case for reach the expected behaviour. More info: https://reactnavigation.org/docs/custom-android-back-button-handling/#why-not-use-component-lifecycle-methods
useCustomBackHandlerEffectfunctionnoneAs I mentioned above, sometimes we should rewrite the basic backHandler behaviour. This property will be a custom hook. See the example for more info: React navigation custom hook example
backHandlerBehaviourstringactiveMinusOneThis prop can controls the backButton behaviour. The value should be activeMinusOne or previous
skipLabelstringSkipCustom label of skip button
nextLabelstringNextCustom label of next button
doneLabelstringDoneCustom label of done button
renderSkipButtonfunctionDefault skip/previous button rendererUse to supply your own skip/previous button
renderNextButtonfunctionDefault next button rendererUse to supply your own next button
renderDoneButtonfunctionDefault done button rendererUse to supply your own done button
onDonefunctionnoneBehaviour of done button
onSkipfunctionnoneBehaviour of skip button
showLeftButtonbooleantrueShow skip or previous button on the left side
leftButtonTypestringskipThe button type on the left side should be skip or previous
columnButtonStylebooleanfalseButtons will show up in a column
showStatusBarbooleanfalseShow status bar on top of screen. You can make your own status bar outside of this component
statusBarColorcolor#febe29Background color of status bar
renderStatusBarfunctionDefault status bar rendererUse to supply your own status bar component

Examples

Troubleshooting

TouchableOpacity onPress function: I've created a new issue on official react-native repository, because TouchableOpacity, Button and Pressable don't working inside PanResponder with react-navigation NavigationContainer. My solution: Import TouchableWithoutFeedback from react-native-gesture-handler instead of react-native and use onPressIn instead of onPress function then overwrite the renderItem function.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Keywords

FAQs

Last updated on 25 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc