Socket
Book a DemoInstallSign in
Socket

react-native-swiper-flatlist

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-swiper-flatlist

React native swiper flatlist component

Source
npmnpm
Version
1.0.11
Version published
Weekly downloads
15K
5.75%
Maintainers
1
Weekly downloads
 
Created
Source

:point_up_2: Swiper FlatList component

platforms npm npm travis license

Demo

Installation

yarn add react-native-swiper-flatlist

or

npm install react-native-swiper-flatlist --save

Example

Expo

Example

Code

import React, { PureComponent } from 'react';
import { Text, Dimensions, Image, StyleSheet, View } from 'react-native';

import SwiperFlatList from 'react-native-swiper-flatlist';

export default class App extends PureComponent {
  render() {
    return (
      <View style={styles.container}>
        <SwiperFlatList
          autoplay
          autoplayDelay={2}
          autoplayLoop
          index={2}
          showPagination
        >
          <View style={[styles.child, { backgroundColor: 'tomato' }]}>
            <Text style={styles.text}>1</Text>
          </View>
          <View style={[styles.child, { backgroundColor: 'thistle' }]}>
            <Text style={styles.text}>2</Text>
          </View>
          <View style={[styles.child, { backgroundColor: 'skyblue' }]}>
            <Text style={styles.text}>3</Text>
          </View>
          <View style={[styles.child, { backgroundColor: 'teal' }]}>
            <Text style={styles.text}>4</Text>
          </View>
        </SwiperFlatList>
      </View>
    );
  }
}

export const { width, height } = Dimensions.get('window');

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: 'white'
  },
  child: {
    height: height * 0.5,
    width,
    justifyContent: 'center'
  },
  text: {
    fontSize: width * 0.5,
    textAlign: 'center'
  }
});

Code example

Props

PropDefaultTypeDescription
datanot required if children is usedarrayData to use in renderItem
children-nodeChildren elements
renderItemnot required if children is usedfuncTakes an item from data and renders it into the list
onMomentumScrollEnd-funcCalled after scroll end and the first parameter is the current index
verticalfalseboolShow vertical swiper
index0numberIndex to start
renderAllfalseboolRender all the items before display it
Pagination
showPaginationfalseboolShow pagination
paginationDefaultColorgraystringPagination color
paginationActiveColorwhitestringPagination color
paginationStyle{}ViewPropTypes.styleStyle object for container
paginationStyleItem{}ViewPropTypes.styleStyle object for item (dot)
PaginationComponentComponentnodeOverwrite Pagination component
Autoplay
autoplayfalseboolChange index automatically
autoplayDelay3numberDelay between every page
autoplayLoopfalseboolContinue playing after reach end

More props

This is a wrapper around Flatlist, all their props works well and the inherited props too (from ScrollView and VirtualizedList)

Functions

NameParamsUse
scrollToIndex(index: number, animated: bool)Forces the scroll of the swiper to a precise index
getCurrentIndex-Returns the current index inside the swiper

Limitations

Note: Vertical pagination is not supported on Android. Doc

Author

Gustavo Gard

Keywords

swiper flatlist

FAQs

Package last updated on 25 Jul 2019

Did you know?

Socket

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