2.1.17 • Published 3 months ago

react-native-slider-intro v2.1.17

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

npm version build platform react-native-slider-intro NPM total downloads license

runs with Expo Go

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 SliderIntroItemProps 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.

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.17

3 months ago

2.1.14

8 months ago

2.1.13

8 months ago

2.1.8

8 months ago

2.1.4

9 months ago

2.1.1

9 months ago

2.0.11

9 months ago

2.0.1

9 months ago

1.0.19

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago