{"id":20763117,"url":"https://github.com/nickpisacane/react-dynamic-swiper","last_synced_at":"2025-04-09T07:09:55.086Z","repository":{"id":10142196,"uuid":"64624716","full_name":"nickpisacane/react-dynamic-swiper","owner":"nickpisacane","description":"React wrapper around iDangerous swiper that auto-magically re-initializes","archived":false,"fork":false,"pushed_at":"2023-01-11T01:01:26.000Z","size":7737,"stargazers_count":109,"open_issues_count":44,"forks_count":32,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-04T22:42:21.122Z","etag":null,"topics":["react","swiper"],"latest_commit_sha":null,"homepage":"https://nickpisacane.github.io/react-dynamic-swiper/","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/nickpisacane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-01T01:08:38.000Z","updated_at":"2024-12-05T10:31:31.000Z","dependencies_parsed_at":"2023-01-13T16:24:17.822Z","dependency_job_id":null,"html_url":"https://github.com/nickpisacane/react-dynamic-swiper","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickpisacane%2Freact-dynamic-swiper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickpisacane%2Freact-dynamic-swiper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickpisacane%2Freact-dynamic-swiper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickpisacane%2Freact-dynamic-swiper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickpisacane","download_url":"https://codeload.github.com/nickpisacane/react-dynamic-swiper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994122,"owners_count":21030050,"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","swiper"],"created_at":"2024-11-17T10:42:45.443Z","updated_at":"2025-04-09T07:09:55.061Z","avatar_url":"https://github.com/nickpisacane.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-dynamic-swiper\n\n[![Travis][travis-image]][travis-url]\n\nReact wrapper for [iDangerous-Swiper][idangerous-swiper] that auto-magically\nreinitializes and updates when configuration changes.\n\n**[Demo](https://nickpisacane.github.io/react-dynamic-swiper)**\n\n# Installation\n\n```sh\n$ npm i --save react-dynamic-swiper\n```\n\n# Usage\n\n```js\n// Basic Usage\nfunction MySwiper() {\n  return (\n    \u003cSwiper\n      swiperOptions={{\n        slidesPerView: 42\n      }}\n      navigation={false}\n      pagination={false}\n    \u003e\n      \u003cSlide onActive={swiper =\u003e console.log('Slide Active!')} /\u003e\n    \u003c/Swiper\u003e\n  )\n}\n\n// Advanced Usage\n//\n// Swiper will automatically update swiper instance when children change (i.e. Slides),\n// and/or re-initialize if swiper options change. Also, event handlers\n// (`onTouchMove`, `onSlideChangeEnd`, etc.) are delegated. Changing them will\n// require no reinitialization, while still functioning as expected.\nimport React, { Component } from 'react'\nimport { Swiper, Slide } from 'react-dynamic-swiper'\nimport 'react-dynamic-swiper/lib/styles.css'\n\nclass MySwiper extends Component {\n  constructor(props, context) {\n    super(props, context)\n    this.state = {\n      slides: []\n    }\n  }\n\n  componentWillMount() {\n    getAsyncSlideData().then(slides =\u003e this.setState({ slides }))\n  }\n\n  render() {\n    const { slides } = this.state\n\n    return (\n      \u003cSwiper\n        swiperOptions={{\n          slidesPerView: 'auto'\n        }}\n        nextButton={\u003cMyNextButton /\u003e}\n        prevButton={swiper =\u003e (\n          \u003cMyPrevButton onClick={() =\u003e swiper.slideNext()} /\u003e\n        )}\n        onTouchMove={(swiper, event) =\u003e doSomething()}\n      \u003e\n        {slides.map(slide =\u003e (\n          \u003cSlide {...slide} /\u003e\n        ))}\n      \u003c/Swiper\u003e\n    )\n  }\n}\n```\n\n# API\n\n## Swiper\n\n#### Props\n\n- swiperOptions (Object) Options passed to swiper instance.\n- containerClassName (String) Classname for underlying container element.\n- wrapperClassName (String) Classname for underlying wrapper element.\n- navigation (Boolean) Display navigation elements (`true`)\n- nextButton (Element|Function) Navigation next element (`\u003cdiv className=\"swiper-button-next\" /\u003e`)\n- prevButton (Element|Function) Navigation previous element (`\u003cdiv className=\"swiper-button-prev\" /\u003e`)\n- pagination (Boolean|Element|Function) Pagination is active by default, use `false` to hide. (`\u003cdiv className=\"swiper-pagination\" /\u003e`)\n- paginationClickable (Boolean) Enable clickable pagination.\n- scrollBar (Boolean|Element|Function) Scrollbar is hidden by default, use `false` to show.\n- onInitSwiper (Function) Function invoked every time swiper instance is initialized, invoked will `swiper` as first argument.\n- All event handlers are supported as well (i.e. onTouchMove, etc.)\n\n_note_: The following props can be functions: nextButton, prevButton, pagination, and scrollBar. If functions, they\nwill be invoked with the underlying `Swiper` instance as the one and only argument. They must return a renderable element.\n\n#### Methods\n\n- swiper() Returns underlying swiper instance.\n\n## Slide\n\n#### Props\n\n- onActive (Function) Invoked with swiper instance when `Slide` is active. Not invoked on initialization.\n\n[idangerous-swiper]: http://idangero.us/swiper\n[travis-image]: https://travis-ci.org/nickpisacane/react-dynamic-swiper.svg?branch=master\n[travis-url]: https://travis-ci.org/nickpisacane/react-dynamic-swiper\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickpisacane%2Freact-dynamic-swiper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickpisacane%2Freact-dynamic-swiper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickpisacane%2Freact-dynamic-swiper/lists"}