2.1.14 • Published 3 days ago

react-native-slider-intro v2.1.14

Weekly downloads
74
License
MIT
Repository
github
Last release
3 days ago

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

yarn add react-native-slider-intro

or

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

iOS

yarn example ios

Android

yarn example android
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.

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
limitToSlidenumber(Device max width) * 0.35Use to change the limit of the slide animation. It is calculated based on the PanResponder's gestureState.dx property. For example, your device's width: 400px, the limit is 400 * 0.35 = 140px, so you need to swipe at least 140px to left or right to reach the next slide in the row.

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.

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

MIT

2.1.14

3 days ago

2.1.13

8 days ago

2.1.8

17 days ago

2.1.4

1 month ago

2.1.1

1 month ago

2.0.11

1 month ago

2.0.1

1 month ago

1.0.19

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago