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

@manjiz/react-native-swiper

v0.1.3

Published

Not the best Swiper component for React Native.

Downloads

22

Readme

This swiper is modified based on leecade/react-native-swiper. Not the best Swiper component for React Native.

  • Fixed some remained bugs.
  • Both iOS and android use ScrollView.
  • Removed some inessentials.
  • Used typescript.
  • Be Tested in one online project (lack of test...need more...)
  • Dependencies Versions:
    • react-native@^0.55.4
    • react@^16.3.1

Example

Installation

npm i @manjiz/react-native-swiper --save

Basic Usage

import React, { Component } from 'react'
import {
  View,
  Text
} from 'react-native'
import Swiper from '@manjiz/react-native-swiper'

class Example extends Component {
  onIndexChanged = (index: number) => {
  }

  onMomentumScrollEnd = (e, state) => {
  }

  render () {
    const slideStyle = { flex: 1, justifyContent: 'center', alignItems: 'center' }

    return (
      <Swiper
        autoplay={true}
        autoplayTimeout={6}
      >
        <View style={[slideStyle, { backgroundColor: 'red' }]}>
          <Text>Red</Text>
        </View>
        <View style={[slideStyle, { backgroundColor: 'green' }]}>
          <Text>Green</Text>
        </View>
        <View style={[slideStyle, { backgroundColor: 'blue' }]}>
          <Text>Blue</Text>
        </View>
      </Swiper>
    )
  }
}

export default Example

Properties

Basic

| Prop | Type | Default | Description | | ----------------- | ------- | ------- | ----------- | | horizontal | boolean | true | If true, the scroll view's children are arranged horizontally in a row instead of vertically in a column | | loop | boolean | true | Set to false to disable continuous loop mode | | autoplay | boolean | false | Set to true enable auto play mode | | index | number | 0 | Index number of initial slide. And real index would be sync as it changed | | loadMinimal | boolean | false | Only load current index slide , loadMinimalSize slides before and after | | loadMinimalSize | number | 1 | see loadMinimal | | showsPagination | boolean | true | Set to false make pagination invisible. | | autoplayTimeout | number | 2.5 | Delay between auto play transitions (in second) | | autoplayDirection | boolean | true | Cycle direction control |

Element

| Prop | Type | Default | Description | | ----------------- | ------- | ------- | ----------- | | loadMinimalLoader | Element | | Custom loader to display when slides aren't loaded | | dot | Element | <View ... /> | Allow custom the dot element | | activeDot | Element | <View ... /> | Allow custom the active-dot element | | renderPagination | (index: number, total: number, swiper: any) => JSX.Element | see source code |

Styleus

| Prop | Type | Default | Description | | ----------------- | --------- | ------- | ----------- | | width | number | - | If no specify default enable fullscreen mode by flex: 1 | | height | number | - | If no specify default fullscreen mode by flex: 1 | | dotColor | string | - | Allow custom the dot element | | activeDotColor | string | - | Allow custom the active-dot element | | containerStyle | ViewStyle | - | See default container style in source | | scrollViewStyle | ViewStyle | - | Style set to ScrollView | | style | ViewStyle | - | Style set to ScrollView contentContainerStyle | | paginationStyle | ViewStyle | - | pagination wrapper style | | dotStyle | ViewStyle | - | Allow custom the dot element | | activeDotStyle | ViewStyle | - | Allow custom the active-dot element |

Native ScrollView Props

No need to change them.

Event

| Prop | Type | Description | | -------------- | ---- | ----------- | | onIndexChanged | index | Called with the new index when the user swiped |

Supported ScrollResponder

| Prop | Type | Description | | -------------- | ---- | ----------- | | onScrollBeginDrag | e / state / context | When animation begins after letting up | | onMomentumScrollEnd | e / state / context | Makes no sense why this occurs first during bounce | | onTouchStartCapture | e / state / context | Immediately after onMomentumScrollEnd | | onTouchStart | e / state / context | Same, but bubble phase | | onTouchEnd | e / state / context | You could hold the touch start for a long time | | onResponderRelease | e / state / context | You could hold the touch start for a long time |

Note: each ScrollResponder be injected with two params: state and context, you can get state and context(ref to swiper's this) from params.

Methods

scrollBy

Scroll by relative index.

Parameters:

| Name | Type | default | Description | | ---- | ---- | ------- | ----------- | | index | number | undefined | offset index | | animated | bool | true | offset index |

Contribution

Local Development

rsync -avr ~/react-native-swiper/dist ~/MyApp/node_modules/@manjiz/react-native-swiper