Installations
npm install react-native-swiper-flatlist
Developer
gusgard
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
16.16.0
NPM Version
8.11.0
Statistics
554 Stars
131 Commits
98 Forks
11 Watching
7 Branches
20 Contributors
Updated on 25 Nov 2024
Languages
TypeScript (43.74%)
JavaScript (26.43%)
Java (17.06%)
Ruby (5.97%)
Objective-C++ (4.09%)
Objective-C (2.59%)
Swift (0.11%)
Total Downloads
Cumulative downloads
Total Downloads
2,132,040
Last day
-16.4%
2,388
Compared to previous day
Last week
8.5%
15,896
Compared to previous week
Last month
-1.2%
64,264
Compared to previous month
Last year
25%
724,018
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
Dev Dependencies
19
:point_up_2: Swiper FlatList component
Installation
yarn add react-native-swiper-flatlist
or
npm install react-native-swiper-flatlist --save
Notice
Version 2.x was re-implemented using React Hooks so it only works with version 0.59 or above
Version 3.x was re-implemented using Typescript and it works with react-native-web
react-native-swiper-flatlist | react-native | Detox tests |
---|---|---|
1.x | <= 0.58 | X |
2.x | >= 0.59 | X |
3.x | >= 0.59 |
Note: we are using the feature export type
available in babel v7.9.0
https://github.com/babel/babel/pull/11171, you might have this issue with React Native between 0.60 and 0.63, please update babel
to at least to v7.9.0
Examples
Expo example with renderItems, children and more
React Native example with renderItems and custom pagination
React Native example with children
Code
1import React from 'react'; 2import { Text, Dimensions, StyleSheet, View } from 'react-native'; 3import { SwiperFlatList } from 'react-native-swiper-flatlist'; 4 5const colors = ['tomato', 'thistle', 'skyblue', 'teal']; 6 7const App = () => ( 8 <View style={styles.container}> 9 <SwiperFlatList 10 autoplay 11 autoplayDelay={2} 12 autoplayLoop 13 index={2} 14 showPagination 15 data={colors} 16 renderItem={({ item }) => ( 17 <View style={[styles.child, { backgroundColor: item }]}> 18 <Text style={styles.text}>{item}</Text> 19 </View> 20 )} 21 /> 22 </View> 23); 24 25const { width } = Dimensions.get('window'); 26const styles = StyleSheet.create({ 27 container: { flex: 1, backgroundColor: 'white' }, 28 child: { width, justifyContent: 'center' }, 29 text: { fontSize: width * 0.5, textAlign: 'center' }, 30}); 31 32export default App;
1import React from 'react'; 2import { Text, Dimensions, StyleSheet, View } from 'react-native'; 3import { SwiperFlatList } from 'react-native-swiper-flatlist'; 4 5const App = () => ( 6 <View style={styles.container}> 7 <SwiperFlatList autoplay autoplayDelay={2} autoplayLoop index={2} showPagination> 8 <View style={[styles.child, { backgroundColor: 'tomato' }]}> 9 <Text style={styles.text}>1</Text> 10 </View> 11 <View style={[styles.child, { backgroundColor: 'thistle' }]}> 12 <Text style={styles.text}>2</Text> 13 </View> 14 <View style={[styles.child, { backgroundColor: 'skyblue' }]}> 15 <Text style={styles.text}>3</Text> 16 </View> 17 <View style={[styles.child, { backgroundColor: 'teal' }]}> 18 <Text style={styles.text}>4</Text> 19 </View> 20 </SwiperFlatList> 21 </View> 22); 23 24const { width } = Dimensions.get('window'); 25 26const styles = StyleSheet.create({ 27 container: { flex: 1, backgroundColor: 'white' }, 28 child: { width, justifyContent: 'center' }, 29 text: { fontSize: width * 0.5, textAlign: 'center' }, 30}); 31 32export default App;
Example project with Detox tests
react-native-gesture-handler
To use react-native-gesture-handler
instead of FlatList import the library like:
1import { SwiperFlatListWithGestureHandler } from 'react-native-swiper-flatlist/WithGestureHandler';
Props
Prop | Default | Type | Description |
---|---|---|---|
data | not required if children is used | array | Data to use in renderItem |
children | - | node | Children elements |
renderItem | not required if children is used | FlatListProps<T>['renderItem'] | Takes an item from data and renders it into the list |
onMomentumScrollEnd | - | (item: { index: number }, event: any) | Called after scroll end and the first parameter is the current index |
vertical | false | boolean | Show vertical swiper |
index | 0 | number | Index to start |
renderAll | false | boolean | Render all the items before display it |
Pagination | |||
showPagination | false | boolean | Show pagination |
paginationDefaultColor | gray | string | Pagination color |
paginationActiveColor | white | string | Pagination color |
paginationStyle | {} | ViewStyle | Style object for the container |
paginationStyleItem | {} | ViewStyle | Style object for the item (dot) |
paginationStyleItemActive | {} | ViewStyle | Style object for the active item (dot) |
paginationStyleItemInactive | {} | ViewStyle | Style object for the inactive item (dot) |
onPaginationSelectedIndex | - | () => void | Executed when the user presses the pagination index, similar properties onChangeIndex |
PaginationComponent | Component | node | Overwrite Pagination component |
Autoplay | |||
autoplay | false | boolean | Change index automatically |
autoplayDelay | 3 | number | Delay between every page in seconds |
autoplayLoop | false | boolean | Continue playing after reach end |
autoplayLoopKeepAnimation | false | boolean | Show animation when reach the end of the list |
autoplayInvertDirection | false | boolean | Invert auto play direction |
disableGesture | false | boolean | Disable swipe gesture |
More props
This is a wrapper around Flatlist, all their props
works well and the inherited props
too (from ScrollView and VirtualizedList)
Functions
Name | Type | Use |
---|---|---|
scrollToIndex | ({ index: number, animated?: boolean}) => void | Scroll to the index |
getCurrentIndex | () => number | Returns the current index |
getPrevIndex | () => number | Returns the previous index |
onChangeIndex | ({ index: number, prevIndex: number}) => void | Executed every time the index change, the index change when the user reaches 60% of the next screen |
goToFirstIndex | () => void | Go to the first index |
goToLastIndex | () => void | Go to the last index |
Right To Left
This library support RTL languages, when I18nManager.isRTL
is true
.
Limitations
- Vertical pagination is not supported on Android. Doc, that is way we have
useReactNativeGestureHandler
which is a workaround for this issue.
Author
Gustavo Gard
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0
Reason
binaries present in source code
Details
- Warn: binary detected: example/android/gradle/wrapper/gradle-wrapper.jar:1
- Warn: binary detected: old-rn-example/android/gradle/wrapper/gradle-wrapper.jar:1
Reason
SAST tool detected but not run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Warn: 0 commits out of 8 are checked with a SAST tool
Reason
5 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 5
Reason
Found 4/30 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1
- Warn: no topLevel permission defined: .github/workflows/node.js.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/gusgard/react-native-swiper-flatlist/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/gusgard/react-native-swiper-flatlist/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/gusgard/react-native-swiper-flatlist/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/gusgard/react-native-swiper-flatlist/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/gusgard/react-native-swiper-flatlist/node.js.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/gusgard/react-native-swiper-flatlist/node.js.yml/master?enable=pin
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
Reason
67 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-6w63-h3fj-q4vw
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-rxrc-rgv4-jpvx
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3
- Warn: Project is vulnerable to: MAL-2023-462
- Warn: Project is vulnerable to: GHSA-f5x2-xv93-4p23
- Warn: Project is vulnerable to: GHSA-gmpm-xp43-f7g6
- Warn: Project is vulnerable to: GHSA-pf27-929j-9pmm
- Warn: Project is vulnerable to: GHSA-327c-qx3v-h673
- Warn: Project is vulnerable to: GHSA-x4cf-6jr3-3qvp
- Warn: Project is vulnerable to: GHSA-mph8-6787-r8hw
- Warn: Project is vulnerable to: GHSA-7mhc-prgv-r3q4
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-v8v8-6859-qxm4
- Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m / GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-w7rc-rwvf-8q5r
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-4cpg-3vgw-4877
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-7f53-fmmv-mfjv
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-gff7-g5r8-mg8m
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-662x-fhqg-9p8v
- Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx
- Warn: Project is vulnerable to: GHSA-78cj-fxph-m83p
- Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-h6q6-9hqw-rwfv
- Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q
- Warn: Project is vulnerable to: GHSA-crh6-fp67-6883
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
Score
3.7
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to react-native-swiper-flatlist
react-native-swiper-flatlist-speedbox
React native swiper flatlist component
react-native-draggable-flatlist
A drag-and-drop-enabled FlatList component for React Native
swiper
Most modern mobile touch slider and framework with hardware accelerated transitions
react-native-swiper
Swiper component for React Native.