{"id":3920,"url":"https://github.com/leecade/react-native-swiper","last_synced_at":"2025-05-15T00:05:35.306Z","repository":{"id":30712377,"uuid":"34268496","full_name":"leecade/react-native-swiper","owner":"leecade","description":"The best Swiper component for React Native.","archived":false,"fork":false,"pushed_at":"2023-07-11T12:50:19.000Z","size":9567,"stargazers_count":10466,"open_issues_count":787,"forks_count":2333,"subscribers_count":146,"default_branch":"master","last_synced_at":"2025-05-07T23:34:58.809Z","etag":null,"topics":["react","react-native","swipe"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leecade.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-20T15:22:55.000Z","updated_at":"2025-04-30T08:18:15.000Z","dependencies_parsed_at":"2024-06-18T10:56:57.442Z","dependency_job_id":"1c07fc28-2dc3-44d2-b579-4c350fc81798","html_url":"https://github.com/leecade/react-native-swiper","commit_stats":{"total_commits":244,"total_committers":90,"mean_commits":"2.7111111111111112","dds":0.8442622950819672,"last_synced_commit":"5827a80002738abd1c0dc08428303c79bbc840c0"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leecade%2Freact-native-swiper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leecade%2Freact-native-swiper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leecade%2Freact-native-swiper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leecade%2Freact-native-swiper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leecade","download_url":"https://codeload.github.com/leecade/react-native-swiper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249199,"owners_count":22039029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","react-native","swipe"],"created_at":"2024-01-05T20:16:55.370Z","updated_at":"2025-05-15T00:05:32.572Z","avatar_url":"https://github.com/leecade.png","language":"JavaScript","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"react-native-swiper\" src=\"http://i.imgur.com/P4cRUgD.png\" width=\"208\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  The best Swiper component for React Native.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://standardjs.com/\"\u003e\u003cimg alt=\"JavaScript Style Guide\" src=\"https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://npmjs.org/package/react-native-swiper\"\u003e\u003cimg alt=\"npm version\" src=\"http://img.shields.io/npm/v/react-native-swiper.svg?style=flat-square\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://npmjs.org/package/react-native-swiper\"\u003e\u003cimg alt=\"npm version\" src=\"http://img.shields.io/npm/dm/react-native-swiper.svg?style=flat-square\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/leecade/react-native-swiper/pulls?q=is%3Apr+is%3Aclosed\"\u003e\u003cimg alt=\"PR Stats\" src=\"https://img.shields.io/issuestats/i/github/leecade/react-native-swiper.svg?style=flat-square\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/leecade/react-native-swiper/issues?q=is%3Aissue+is%3Aclosed\"\u003e\u003cimg alt=\"Issue Stats\" src=\"https://img.shields.io/issuestats/p/github/leecade/react-native-swiper.svg?style=flat-square\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://gitter.im/leecade/react-native-swiper?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge\"\u003e\u003cimg alt=\"Join the chat\" src=\"https://badges.gitter.im/leecade/react-native-swiper.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# react-native-swiper\n\n## Roadmap\n\n\u003e see: [ROADMAP.md](ROADMAP.md)\n\n## Changelogs\n\n- **[1.6.0-rc]**\n  - Dependency\n    - Remove ViewPagerAndroid, use ScrollView #1009\n  - Test Integration\n    - Setup e2e test\n  - TypeScript\n    - correct the wrong types #1000\n    - Add missing scrollBy TypeScript definition #931\n  - New Feature\n    - add scrollTo #831\n    - Added prop to disable the PrevButton #749\n    - Optionally render page #1004\n  - Bug Fix\n    - ES6 and CommonJS compatibility #717\n    - Solves the issue of state messing up when parent component calls setState #939\n    - replay when autoplay is setted to true #1002\n    - fix broken examples and migrate to react-native 0.60.x\n    - fix bad jumping on ios when loadMinimal set true\n    - fix fliker when loop and loadMinimal are enabled #1062\n\n* [1.5.6]\n\n  - Fix [#16](https://github.com/leecade/react-native-swiper/issues/16), [#36](https://github.com/leecade/react-native-swiper/issues/36), [#371](https://github.com/leecade/react-native-swiper/issues/371), [#410](https://github.com/leecade/react-native-swiper/issues/410), [#411](https://github.com/leecade/react-native-swiper/issues/411), [#422](https://github.com/leecade/react-native-swiper/issues/422), [#468](https://github.com/leecade/react-native-swiper/issues/468) Fix landscape orientation auto resize! (thanks [@ahmed3mar](https://github.com/ahmed3mar), [@timmywil](https://github.com/timmywil))\n  - Add containerStyle prop to customize the view container.\n\n* [1.5.5]\n  - Update: using PropTypes from prop-types and Change View.propTypes to ViewPropTypes\n\n- [1.5.4]\n\n  - Added easily accessible pagination point manipulation: use `dotColor` / `activeDotColor` and `dotStyle` / `activeDotStyle` (thanks [@denizs](https://github.com/denizs))\n  - Added scrollEnabled prop to documentation (thanks [@ibandominguez](https://github.com/ibandominguez))\n\n- [1.5.3]\n\n  - Add loadMinimalLoader prop to customize `\u003cActivityIndicator /\u003e` (thanks [@Exilz](https://github.com/Exilz))\n  - Disable autoplay timer when prop changes to false (thanks [@dizlexik](https://github.com/dizlexik))\n  - Special thanks to [@hypatiah](https://github.com/dizlexik) for fixed some grammatical errors in README\n\n- [1.5.2]\n  - Add yarn lock\n  - Fix jitter when quickly swiping back and forth between pages (iOS) (thanks [@nemophrost](https://github.com/nemophrost))\n  - The first webview always reloaded when injecting the rest of the children (thanks [@eosterberg](https://github.com/eosterberg))\n\n\u003e see more: [CHANGELOG.md](CHANGELOG.md)\n\n## Show Cases\n\n\u003e Try these cases by yourself very easy, Just open `examples/ios/swiper.xcodeproj` in Xcode, then press `Cmd + R`; you may edit `examples/index.ios.js` for switch cases.\n\n### [examples/components/Basic](https://github.com/leecade/react-native-swiper/blob/master/examples/components/Basic)\n\n![](http://i.imgur.com/zrsazAG.gif=300x)\n\n### [examples/components/Swiper](https://github.com/leecade/react-native-swiper/blob/master/examples/components/Swiper)\n\n![](http://i.imgur.com/hP3f3oO.gif=300x)\n\n### [examples/components/SwiperNumber](https://github.com/leecade/react-native-swiper/blob/master/examples/components/SwiperNumber)\n\n![](http://i.imgur.com/0rqESVb.gif=300x)\n\n### [examples/components/Phone](https://github.com/leecade/react-native-swiper/blob/master/examples/components/Phone)\n\n![](http://i.imgur.com/c1BhjZm.gif=300x)\n\n### [examples/components/LoadMinimal](https://github.com/leecade/react-native-swiper/blob/master/examples/components/LoadMinimal)\n\n![](http://i.imgur.com/LAOHbJA.gif=300x)\n\n## Getting Started\n\n- [Installation](#installation)\n- [Basic Usage](#basic-usage)\n- [Properties](#properties)\n  - [Basic](#basic)\n  - [Custom basic style \u0026 content](#custom-basic-style--content)\n  - [Pagination](#pagination)\n  - [Autoplay](#autoplay)\n  - [Control buttons](#control-buttons)\n  - [Props of Children](#props-of-children)\n  - [Basic props of `\u003cScrollView /\u003e`](#basic-props-of-scrollview-)\n  - [Supported ScrollResponder](#supported-scrollresponder)\n- [Examples](#examples)\n- [Development](#development)\n\n### Installation\n\n\u003e v1.5.14\n\n```bash\n$ npm i react-native-swiper --save\n```\n\n\u003e v1.6.0-rc\n\n```\nnpm i --save react-native-swiper@next\n```\n\n### Basic Usage\n\n- Install `react-native` first\n\n```bash\n$ npm i react-native-cli -g\n```\n\n- Initialization of a react-native project\n\n```bash\n$ react-native init myproject\n```\n\n- Then, edit `myproject/index.ios.js`, like this:\n\n```jsx\nimport React, { Component } from 'react'\nimport { AppRegistry, StyleSheet, Text, View } from 'react-native'\n\nimport Swiper from 'react-native-swiper'\n\nconst styles = StyleSheet.create({\n  wrapper: {},\n  slide1: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    backgroundColor: '#9DD6EB'\n  },\n  slide2: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    backgroundColor: '#97CAE5'\n  },\n  slide3: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    backgroundColor: '#92BBD9'\n  },\n  text: {\n    color: '#fff',\n    fontSize: 30,\n    fontWeight: 'bold'\n  }\n})\n\nexport default class SwiperComponent extends Component {\n  render() {\n    return (\n      \u003cSwiper style={styles.wrapper} showsButtons={true}\u003e\n        \u003cView style={styles.slide1}\u003e\n          \u003cText style={styles.text}\u003eHello Swiper\u003c/Text\u003e\n        \u003c/View\u003e\n        \u003cView style={styles.slide2}\u003e\n          \u003cText style={styles.text}\u003eBeautiful\u003c/Text\u003e\n        \u003c/View\u003e\n        \u003cView style={styles.slide3}\u003e\n          \u003cText style={styles.text}\u003eAnd simple\u003c/Text\u003e\n        \u003c/View\u003e\n      \u003c/Swiper\u003e\n    )\n  }\n}\n\nAppRegistry.registerComponent('myproject', () =\u003e SwiperComponent)\n```\n\n### Properties\n\n#### Basic\n\n| Prop           |     Default     |   Type   | Description                                                                                                 |\n| :------------- | :-------------: | :------: | :---------------------------------------------------------------------------------------------------------- |\n| horizontal     |      true       |  `bool`  | If `true`, the scroll view's children are arranged horizontally in a row instead of vertically in a column. |\n| loop           |      true       |  `bool`  | Set to `false` to disable continuous loop mode.                                                             |\n| index          |        0        | `number` | Index number of initial slide.                                                                              |\n| showsButtons   |      false      |  `bool`  | Set to `true` make control buttons visible.                                                                 |\n| autoplay       |      false      |  `bool`  | Set to `true` enable auto play mode.                                                                        |\n| onIndexChanged | (index) =\u003e null |  `func`  | Called with the new index when the user swiped                                                              |\n\n#### Custom basic style \u0026 content\n\n| Prop              |         Default         |   Type    | Description                                                                |\n| :---------------- | :---------------------: | :-------: | :------------------------------------------------------------------------- |\n| width             |            -            | `number`  | If no specify default enable fullscreen mode by `flex: 1`.                 |\n| height            |            -            | `number`  | If no specify default fullscreen mode by `flex: 1`.                        |\n| style             |          {...}          |  `style`  | See default style in source.                                               |\n| containerStyle    |          {...}          |  `style`  | See default container style in source.                                     |\n| loadMinimal       |          false          |  `bool`   | Only load current index slide , `loadMinimalSize` slides before and after. |\n| loadMinimalSize   |            1            | `number`  | see `loadMinimal`                                                          |\n| loadMinimalLoader | `\u003cActivityIndicator /\u003e` | `element` | Custom loader to display when slides aren't loaded                         |\n\n#### Pagination\n\n| Prop             |                                                                          Default                                                                          |    Type    | Description                                                                                                                                                                                   |\n| :--------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| showsPagination  |                                                                           true                                                                            |   `bool`   | Set to `true` make pagination visible.                                                                                                                                                        |\n| paginationStyle  |                                                                           {...}                                                                           |  `style`   | Custom styles will merge with the default styles.                                                                                                                                             |\n| 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. |\n| dot              | `\u003cView style={{backgroundColor:'rgba(0,0,0,.2)', width: 8, height: 8,borderRadius: 4, marginLeft: 3, marginRight: 3, marginTop: 3, marginBottom: 3,}} /\u003e` | `element`  | Allow custom the dot element.                                                                                                                                                                 |\n| activeDot        |   `\u003cView style={{backgroundColor: '#007aff', width: 8, height: 8, borderRadius: 4, marginLeft: 3, marginRight: 3, marginTop: 3, marginBottom: 3,}} /\u003e`    | `element`  | Allow custom the active-dot element.                                                                                                                                                          |\n| dotStyle         |                                                                             -                                                                             |  `object`  | Allow custom the dot element.                                                                                                                                                          |\n| dotColor         |                                                                             -                                                                             |  `string`  | Allow custom the dot element.                                                                                                                                                          |\n| activeDotColor   |                                                                             -                                                                             |  `string`  | Allow custom the active-dot element.                                                                                                                                                          |\n| activeDotStyle   |                                                                             -                                                                             |  `object`  | Allow custom the active-dot element.                                                                                                                                                          |\n\n#### Autoplay\n\n| Prop              | Default |   Type   | Description                                      |\n| :---------------- | :-----: | :------: | :----------------------------------------------- |\n| autoplay          |  true   |  `bool`  | Set to `true` enable auto play mode.             |\n| autoplayTimeout   |   2.5   | `number` | Delay between auto play transitions (in second). |\n| autoplayDirection |  true   |  `bool`  | Cycle direction control.                         |\n\n#### Control buttons\n\n| Prop               |                                                                                                   Default                                                                                                   |   Type    | Description                                 |\n| :----------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------: | :------------------------------------------ |\n| showsButtons       |                                                                                                    true                                                                                                     |  `bool`   | Set to `true` make control buttons visible. |\n| 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.                              |\n| nextButton         |                                                                                 `\u003cText style={styles.buttonText}\u003e›\u003c/Text\u003e`                                                                                  | `element` | Allow custom the next button.               |\n| prevButton         |                                                                                 `\u003cText style={styles.buttonText}\u003e‹\u003c/Text\u003e`                                                                                  | `element` | Allow custom the prev button.               |\n\n#### Props of Children\n\n| Prop  |               Default                |   Type    | Description                                                    |\n| :---- | :----------------------------------: | :-------: | :------------------------------------------------------------- |\n| style |                {...}                 |  `style`  | Custom styles will merge with the default styles.              |\n| title | {\u003cText numberOfLines={1}\u003e...\u003c/Text\u003e} | `element` | If this parameter is not specified, will not render the title. |\n\n#### Basic props of `\u003cScrollView /\u003e`\n\n| Prop                             | Default |  Type  | Description                                                                                                                                                                                                                                     |\n| :------------------------------- | :-----: | :----: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| horizontal                       |  true   | `bool` | If `true`, the scroll view's children are arranged horizontally in a row instead of vertically in a column.                                                                                                                                     |\n| 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.                                                                                                               |\n| showsHorizontalScrollIndicator   |  false  | `bool` | Set to `true` if you want to show horizontal scroll bar.                                                                                                                                                                                        |\n| showsVerticalScrollIndicator     |  false  | `bool` | Set to `true` if you want to show vertical scroll bar.                                                                                                                                                                                          |\n| 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. |\n| scrollsToTop                     |  false  | `bool` | If true, the scroll view scrolls to top when the status bar is tapped.                                                                                                                                                                          |\n| 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.                                                            |\n| automaticallyAdjustContentInsets |  false  | `bool` | Set to `true` if you need adjust content insets automation.                                                                                                                                                                                     |\n| scrollEnabled                    |  true   | `bool` | Enables/Disables swiping                                                                                                                                                                                                                        |\n\n\u003e @see: http://facebook.github.io/react-native/docs/scrollview.html\n\n#### Supported ScrollResponder\n\n| Prop                |          Params           |    Type    | Description                                                 |\n| :------------------ | :-----------------------: | :--------: | :---------------------------------------------------------- |\n| onScrollBeginDrag   | `e` / `state` / `context` | `function` | When animation begins after letting up                      |\n| onMomentumScrollEnd | `e` / `state` / `context` | `function` | Makes no sense why this occurs first during bounce          |\n| onTouchStartCapture | `e` / `state` / `context` | `function` | Immediately after `onMomentumScrollEnd`                     |\n| onTouchStart        | `e` / `state` / `context` | `function` | Same, but bubble phase                                      |\n| onTouchEnd          | `e` / `state` / `context` | `function` | You could hold the touch start for a long time              |\n| onResponderRelease  | `e` / `state` / `context` | `function` | When lifting up - you could pause forever before \\* lifting |\n\n\u003e Note: each ScrollResponder be injected with two params: `state` and `context`, you can get `state` and `context`(ref to swiper's `this`) from params, for example:\n\n```jsx\nvar swiper = React.createClass({\n  _onMomentumScrollEnd: function (e, state, context) {\n    console.log(state, context.state)\n  },\n  render: function() {\n    return (\n      \u003cSwiper style={styles.wrapper}\n      onMomentumScrollEnd ={this._onMomentumScrollEnd}\n     ...\n      \u003c/Swiper\u003e\n    )\n  }\n})\n```\n\n\u003e More ScrollResponder info, see: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollResponder.js\n\n### Methods\n\n#### scrollBy(index, animated)\n\nScroll by relative index.\n\nParameters:\n\n| Name     |   Type   |   default   | Description  |\n| :------- | :------: | :---------: | :----------- |\n| index    | `number` | `undefined` | offset index |\n| animated |  `bool`  |   `true`    | offset index |\n\n### Examples\n\n```bash\n$ cd examples\n$ npm i\n$ react-native run-ios\n```\n\n\u003e Quick start with [examples](https://github.com/leecade/react-native-swiper/tree/master/examples/).\n\n### Development\n\n```bash\n$ cd examples\n$ yarn\n$ yarn start\n$ react-native run-ios\n```\n\nThen launch simulator to preview. Note that you just need to edit the source file `src/index.js`, the change will auto sync to examples.\n\nAfter 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](https://github.com/wix/Detox) for more detail.\n\n## Contribution\n\n- [@leecade](mailto:leecade@163.com) The main author.\n- [@rajkissu](mailto:rajkissu@gmail.com) The secondary contributor.\n\n## Questions\n\nFeel free to [contact me](mailto:leecade@163.com) or [create an issue](https://github.com/leecade/react-native-swiper/issues/new)\n\n\u003e Inspired by [nolimits4web/Swiper](https://github.com/nolimits4web/swiper/) \u0026 Design material from [Dribbble](https://dribbble.com/) \u0026 made with ♥.\n","funding_links":[],"categories":["Components","组件","JavaScript","Libraries","Others","reactNative"],"sub_categories":["UI","ViewPager","Viewer/Swiper/Carousel","Releases"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleecade%2Freact-native-swiper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleecade%2Freact-native-swiper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleecade%2Freact-native-swiper/lists"}