1.0.2 • Published 4 years ago

react-native-slider-pagination v1.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

A React Native component that renders a slider pagination.

By installing this component you can paginate like this

npm.io

You can customize color and style like so

npm.io

Installation


Install react-native-slider-pagination with npm:

$ npm install react-native-slider-pagination --save

The easiest way to get going

import { SliderPaginationView } from 'react-native-slider-pagination';

//Other code here

render() {
    const your_function_name = (pageNum) => {
        //pageNum is the page number selected.
    };
    <SliderPaginationView
        pageCount={10}
        onPageChange={your_function_name}
    />
}

Since @react-native-community/slider, a dependency, is incompatible with Expo, you will need to set up the React Native CLI environment. More about that here.

Props:

pageCount
previousLabel
nextLabel
onPageChange
initialPage
disableInitialCallback
containerClassName
previousClassName
nextClassName
previousLinkClassName
nextLinkClassName
sliderClassName
disabledPageLabel
sliderStyle
pageLabelSelectedStyle
pageLabelUnselectedStyle minimumTrackTintColor maximumTrackTintColor thumbTintColor


pageCount
Number of pages that will be displayed on the slider.

TypeRequired
numberYes

previousLabel
Fragment that will be used as the previous page label.

TypeRequired
nodeNo

nextLabel
Fragment that will be used as the next page label.

TypeRequired
nodeNo

onPageChange
Callback that is called when a page is selected. The selected page number is passed as a parameter.

TypeRequired
funcNo

initialPage
Initial page that the slider should be rendered on.

TypeRequired
numberNo

disableInitialCallback
Boolean that can disable onPageChange when the component is rendered.

TypeRequired
boolNo

containerClassName
Classname of the container of the component.

TypeRequired
stringNo

previousClassName
Classname of the view that contains the TouchableOpacity component of the previous label.

TypeRequired
stringNo

nextClassName
Classname of the view that contains the TouchableOpacity component of the next label.

TypeRequired
stringNo

previousLinkClassName
Classname of the TouchableOpacity component that contains the previous label.

TypeRequired
stringNo

nextLinkClassName
Classname of the TouchableOpacity component that contains the next label.

TypeRequired
stringNo

sliderClassName
Classname of the Slider component.

TypeRequired
stringNo

disabledPageLabel
Boolean that can disable the Page label above the slider pagination.

TypeRequired
boolNo

sliderStyle
Style object for the Slider.

TypeRequired
objectNo

pageLabelSelectedStyle
Style object of the page label when it shows the current page.

TypeRequired
objectNo

pageLabelUnselectedStyle
Style object of the page label when it shows pages other than the current page.

TypeRequired
objectNo

minimumTrackTintColor

Color of the track left of the thumb on the slider.

TypeRequired
stringNo

maximumTrackTintColor

Color of the track right of the thumb on the slider.

TypeRequired
stringNo

thumbTintColor

Color of the thumb on the slider.

TypeRequired
stringNo