Gathering detailed insights and metrics for react-native-swiper
Gathering detailed insights and metrics for react-native-swiper
Gathering detailed insights and metrics for react-native-swiper
Gathering detailed insights and metrics for react-native-swiper
react-native-swiper-flatlist
React native swiper flatlist component
react-native-image-swiper
A Simple Images Slider using [react-native-swiper](https://github.com/leecade/react-native-swiper)
react-native-swiper-flatlist-speedbox
React native swiper flatlist component
swiper
Most modern mobile touch slider and framework with hardware accelerated transitions
npm install react-native-swiper
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
10,427 Stars
364 Commits
2,340 Forks
148 Watching
67 Branches
76 Contributors
Updated on 25 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
22.5%
18,140
Compared to previous day
Last week
15.9%
84,602
Compared to previous week
Last month
7.3%
318,416
Compared to previous month
Last year
9.4%
3,549,296
Compared to previous year
1
5
The best Swiper component for React Native.
see: ROADMAP.md
[1.5.6]
[1.5.5]
[1.5.4]
dotColor
/ activeDotColor
and dotStyle
/ activeDotStyle
(thanks @denizs)[1.5.3]
[1.5.2]
see more: CHANGELOG.md
Try these cases by yourself very easy, Just open
examples/ios/swiper.xcodeproj
in Xcode, then pressCmd + R
; you may editexamples/index.ios.js
for switch cases.
v1.5.14
1$ npm i react-native-swiper --save
v1.6.0-rc
npm i --save react-native-swiper@next
react-native
first1$ npm i react-native-cli -g
1$ react-native init myproject
myproject/index.ios.js
, like this:1import React, { Component } from 'react' 2import { AppRegistry, StyleSheet, Text, View } from 'react-native' 3 4import Swiper from 'react-native-swiper' 5 6const styles = StyleSheet.create({ 7 wrapper: {}, 8 slide1: { 9 flex: 1, 10 justifyContent: 'center', 11 alignItems: 'center', 12 backgroundColor: '#9DD6EB' 13 }, 14 slide2: { 15 flex: 1, 16 justifyContent: 'center', 17 alignItems: 'center', 18 backgroundColor: '#97CAE5' 19 }, 20 slide3: { 21 flex: 1, 22 justifyContent: 'center', 23 alignItems: 'center', 24 backgroundColor: '#92BBD9' 25 }, 26 text: { 27 color: '#fff', 28 fontSize: 30, 29 fontWeight: 'bold' 30 } 31}) 32 33export default class SwiperComponent extends Component { 34 render() { 35 return ( 36 <Swiper style={styles.wrapper} showsButtons={true}> 37 <View style={styles.slide1}> 38 <Text style={styles.text}>Hello Swiper</Text> 39 </View> 40 <View style={styles.slide2}> 41 <Text style={styles.text}>Beautiful</Text> 42 </View> 43 <View style={styles.slide3}> 44 <Text style={styles.text}>And simple</Text> 45 </View> 46 </Swiper> 47 ) 48 } 49} 50 51AppRegistry.registerComponent('myproject', () => SwiperComponent)
Prop | Default | Type | Description |
---|---|---|---|
horizontal | true | bool | If true , the scroll view's children are arranged horizontally in a row instead of vertically in a column. |
loop | true | bool | Set to false to disable continuous loop mode. |
index | 0 | number | Index number of initial slide. |
showsButtons | false | bool | Set to true make control buttons visible. |
autoplay | false | bool | Set to true enable auto play mode. |
onIndexChanged | (index) => null | func | Called with the new index when the user swiped |
Prop | Default | Type | Description |
---|---|---|---|
width | - | number | If no specify default enable fullscreen mode by flex: 1 . |
height | - | number | If no specify default fullscreen mode by flex: 1 . |
style | {...} | style | See default style in source. |
containerStyle | {...} | style | See default container style in source. |
loadMinimal | false | bool | Only load current index slide , loadMinimalSize slides before and after. |
loadMinimalSize | 1 | number | see loadMinimal |
loadMinimalLoader | <ActivityIndicator /> | element | Custom loader to display when slides aren't loaded |
Prop | Default | Type | Description |
---|---|---|---|
showsPagination | true | bool | Set to true make pagination visible. |
paginationStyle | {...} | style | Custom styles will merge with the default styles. |
renderPagination | - | function | Complete control how to render pagination with three params (index , total , context ) ref to this.state.index / this.state.total / this , For example: show numbers instead of dots. |
dot | <View style={{backgroundColor:'rgba(0,0,0,.2)', width: 8, height: 8,borderRadius: 4, marginLeft: 3, marginRight: 3, marginTop: 3, marginBottom: 3,}} /> | element | Allow custom the dot element. |
activeDot | <View style={{backgroundColor: '#007aff', width: 8, height: 8, borderRadius: 4, marginLeft: 3, marginRight: 3, marginTop: 3, marginBottom: 3,}} /> | element | Allow custom the active-dot element. |
dotStyle | - | object | Allow custom the dot element. |
dotColor | - | string | Allow custom the dot element. |
activeDotColor | - | string | Allow custom the active-dot element. |
activeDotStyle | - | object | Allow custom the active-dot element. |
Prop | Default | Type | Description |
---|---|---|---|
autoplay | true | bool | Set to true enable auto play mode. |
autoplayTimeout | 2.5 | number | Delay between auto play transitions (in second). |
autoplayDirection | true | bool | Cycle direction control. |
Prop | Default | Type | Description |
---|---|---|---|
showsButtons | true | bool | Set to true make control buttons visible. |
buttonWrapperStyle | {backgroundColor: 'transparent', flexDirection: 'row', position: 'absolute', top: 0, left: 0, flex: 1, paddingHorizontal: 10, paddingVertical: 10, justifyContent: 'space-between', alignItems: 'center'} | style | Custom styles. |
nextButton | <Text style={styles.buttonText}>›</Text> | element | Allow custom the next button. |
prevButton | <Text style={styles.buttonText}>‹</Text> | element | Allow custom the prev button. |
Prop | Default | Type | Description |
---|---|---|---|
style | {...} | style | Custom styles will merge with the default styles. |
title | { | element | If this parameter is not specified, will not render the title. |
<ScrollView />
Prop | Default | Type | Description |
---|---|---|---|
horizontal | true | bool | If true , the scroll view's children are arranged horizontally in a row instead of vertically in a column. |
pagingEnabled | true | bool | If true, the scroll view stops on multiples of the scroll view's size when scrolling. This can be used for horizontal pagination. |
showsHorizontalScrollIndicator | false | bool | Set to true if you want to show horizontal scroll bar. |
showsVerticalScrollIndicator | false | bool | Set to true if you want to show vertical scroll bar. |
bounces | false | bool | If true , the scroll view bounces when it reaches the end of the content if the content is larger then the scroll view along the axis of the scroll direction. If false , it disables all bouncing even if the alwaysBounce* props are true. |
scrollsToTop | false | bool | If true, the scroll view scrolls to top when the status bar is tapped. |
removeClippedSubviews | true | bool | If true, offscreen child views (whose overflow value is hidden) are removed from their native backing superview when offscreen. This canimprove scrolling performance on long lists. |
automaticallyAdjustContentInsets | false | bool | Set to true if you need adjust content insets automation. |
scrollEnabled | true | bool | Enables/Disables swiping |
@see: http://facebook.github.io/react-native/docs/scrollview.html
Prop | Params | Type | Description |
---|---|---|---|
onScrollBeginDrag | e / state / context | function | When animation begins after letting up |
onMomentumScrollEnd | e / state / context | function | Makes no sense why this occurs first during bounce |
onTouchStartCapture | e / state / context | function | Immediately after onMomentumScrollEnd |
onTouchStart | e / state / context | function | Same, but bubble phase |
onTouchEnd | e / state / context | function | You could hold the touch start for a long time |
onResponderRelease | e / state / context | function | When lifting up - you could pause forever before * lifting |
Note: each ScrollResponder be injected with two params:
state
andcontext
, you can getstate
andcontext
(ref to swiper'sthis
) from params, for example:
1var swiper = React.createClass({ 2 _onMomentumScrollEnd: function (e, state, context) { 3 console.log(state, context.state) 4 }, 5 render: function() { 6 return ( 7 <Swiper style={styles.wrapper} 8 onMomentumScrollEnd ={this._onMomentumScrollEnd} 9 ... 10 </Swiper> 11 ) 12 } 13})
More ScrollResponder info, see: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollResponder.js
Scroll by relative index.
Parameters:
Name | Type | default | Description |
---|---|---|---|
index | number | undefined | offset index |
animated | bool | true | offset index |
1$ cd examples 2$ npm i 3$ react-native run-ios
Quick start with examples.
1$ cd examples 2$ yarn 3$ yarn start 4$ react-native run-ios
Then launch simulator to preview. Note that you just need to edit the source file src/index.js
, the change will auto sync to examples.
After development, you should add test for your modification and make all tests passed to prevent other contributors break the feature in the future accidentally. We use detox + jest for e2e test now, you can read Detox for more detail.
Feel free to contact me or create an issue
Inspired by nolimits4web/Swiper & Design material from Dribbble & made with ♥.
No vulnerabilities found.
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 12/19 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
72 existing vulnerabilities detected
Details
Score
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 More