npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-hooks-swiper

v1.1.1

Published

A powerful Swiper hooks component for React Native

Downloads

3

Readme

Tips: This component has been moved to the new new npm & github repository named "react-native-swiper-hooks".

you can still use this component, but I will updata it only on the new repository


Hello, folks!

🦄 This is a wonderful animated carsouel hooks component for React-Native

✨ 为React Native开发的轮播展示动画组件

👨🏻‍💻 Powered by Voyz Shen

🏫 Shanghai Jiao Tong University, Ctrip

react-native-hooks-swiper

Catalog


Demo

autoplay ↓

autoplay

non-autoplay ↓

no_autoplay.gif

non-loop ↓

non-loop.gif


How to use

  • install
npm i react-native-hooks-swiper --save
  • import
import Swiper from 'react-native-hooks-swiper'
  • Demo
...
const _renderList = ()=>{
	 let listData = [
      {
        title:'1',
        bgColor:'#f00'
      },
      {
        title:'2',
        bgColor:'#0f0'
      },
      {
        title:'3',
        bgColor:'#00f'
      },
    ]
    return (
      listData.map((item,idx)=>{
        return (
          <View style={{width:WIDTH,height:300,backgroundColor:item.bgColor,justifyContent: 'center',alignItems: 'center'}} key={idx}>
              <Text>{item.title}</Text>
          </View>
        )
      })
    )
}

...

<Swiper height={300}
        autoplay={true}
        loop={true}
        showPagination={true}
        bounces={false}>
  {_renderList()}
</Swiper>

...

Properties

pagination-shower.jpg

- Basic -

|Prop|Default|Options|Type|Description| |:---|:--:|:--:|:--:|:---| |width|[width of screen]|/|Number|Width of the Swiper container| |||||容器宽度| |height|[height of screen]|/| Number |Height of the Swiper container| |||||容器高度| |boxBackgroundColor|/|/|Color|Background color of the Swiper container| |||||容器背景颜色| |initIndex|0|/|Number|Index of the init child| |||||初始页| |direction|'row'|'row' / 'column'|String|Direction of the scrolling | |||||滚动方向| |minOffset|10|/|Number| Threshold of scroll distance for page turning| |||||翻页的滚动阈值| |autoplay|true|true / false|Boolean|Enable autoplay | |||||是否自动播放| |loop|true|true / false|Boolean|Enable loop mode | |||||是否循环滚动| |autoplayGapTime|3|/|Number|second between autoplay transitions| |||||自动播放时间间隔| |autoplayDirection|true|true / false|Boolean| Enable forward direction when autoplay| |||||是否正向自动播放| |scrollEnabled|true|true / false|Boolean|Enable hand-rolling | |||||是否可以手动滚动| |animated|true|true / false|Boolean|Enable smooth scrolling animation| |||||是否开启滚动动画| |bounces|true|true / false|Boolean|Enable pull flexibly when you scroll to the head and tail| |||||到达首尾时是否可以弹性拉动一截|

- Pagination -

|Prop|Default|Options|Type|Description| |:---|:--:|:--:|:--:|:---| |showPagination|true|true / false|Boolean|Enable pagination shower | |||||是否显示页码器| |paginationDirection|'bottom'|'bottom' / 'top' / 'left' / 'right' |String|Position of the pagination| |||||页码器位置| |paginationOffset|5|/|Number|Distance between pagination shower and side| |||||页码器距边距离| |paginationUnselectedSize|6|/|Number|Size of the point (non-current)| |||||提示点大小(非当前页)| |paginationSelectedSize|10|/|Number|Size of the point (current)| |||||提示点大小(当前页)| |paginationUnselectedColor|'#FFFFFF'|/|Color|Color of the point (non-current)| |||||提示点颜色(非当前页)| |paginationSelectedSize|'#000000'|/|Color|Color of the point (current)| |||||提示点颜色(当前页)|

Functions

- callback -

|Func|Params|Type| Description | |:---|:--:|:--:|:---| |onPaginationChange|index|Number|Retrun the index of current page when it changes| ||||页码改变时返回当前页码索引| |onScrollBeginDrag|nativeEvent|Object|Callback on scroll begin drag| ||||开始拖动时的回调函数| |onScrollEndDrag| nativeEvent | Object |Callback on scroll end drag| ||||结束拖动时的回调函数|