New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-native-stuff-swiper

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-stuff-swiper

[![npm](https://img.shields.io/npm/v/react-native-stuff-swiper?style=flat-square)](https://www.npmjs.com/package/react-native-stuff-swiper)

latest
Source
npmnpm
Version
2.1.3
Version published
Maintainers
1
Created
Source

react-native-stuff-swiper

npm

A lightweight React Native component for swipe stuff out!

Besides horizontal swipe motion, it has support for side buttons, static header and footer.

Usage

 import React, { useRef, useState } from 'react';
 import StuffSwiper from 'react-native-stuff-swiper';
 ...
 
 const YourAwesomeComponent = () => {
  const [screensData, setScreensData] = useState(null);
  const swiperRef = useRef(null);

  const onPaginationChange = ({ pagination, total, currentIndex})  => {
    // Do your stuff here ...
  }

  return (
    <StuffSwiper
      ref={swiperRef}
      HeaderComponent={<YourHeaderComponent />}
      screensData={screensData}
      enableSideButtons
      loop
      onPaginationChange={onPaginationChange}
      DefaultScreenComponent={MyScreenComponent}
    />
  );
};

NOTE: ref it's required in order to use public methods (e.g. swiperRef.current.goToIndex(0) in the above example)

screensData example

screenData prop must be an array of objects with the following format:

    {
        id: 2,
        screen: <ReactComponent />,
        // OR
        props: {
          //your props
        }
    }

Example of full screensData array:

Without Default screen component:

[
  {
    id: '1',
    screen: 
    	<View>
    		<Text>My first screen </Text>
    	</View>,
  },
  {
    id: '2',
    screen: 
      <View>
        <FlatList
          data={myListInfos}
          keyExtractor={(item, index) => item + index}
          renderItem={({ item }) => <Text style={{ fontSize: 16 }}>{item}</Text>}
        />
      </View>,
  },
  {
    id: '3',
    screen: 
        <Image
          style={{width: 100, height: 100}}
          source={{uri: 'https://facebook.github.io/react-native/img/tiny_logo.png'}}
        />
  },
]

With Default screen component:

[
  {
    id: '1',
    props: {
      title: 'first screen',
    },
  {
    id: '2',
    props: {
      title: 'second screen',
    },
  },
  {
    id: '3',
    props: {
      title: 'third screen',
      // any other props that you want to be injected into our DefaultScreenComponent
    },
  },
]

API Reference

Props

Prop nameInfoType
onPaginationChangeCallback that returns pagination (aka formatted current/total), currentIndex and totalFunction
loopSpecify if the loop behaviour it's enabled (default: false)Bool
animatedSpecify if the animations are enabled (default: true)Bool
screensDataData that will be rendered on screensArray of Objects
HeaderComponentComponent that will be rendered as headerReact Component
FooterComponentComponent that will be rendered as footerReact Component
DefaultScreenComponentComponent that will be rendered as screenReact Component
DefaultScreenPropsGlobal Props that will be injected in DefaultScreenComponentObject
enableSideButtonsSpecify if side buttons are enabled (default: false)Bool
nextButtonComponentComponent that will be rendered as next side buttonReact Component
previousButtonComponentComponent that will be rendered as previous side buttonReact Component
styleHeaderContainerSpecify the header container stylesStyle Object
styleFooterContainerSpecify the footer container stylesStyle Object
styleContentContainerSpecify the content container stylesStyle Object
styleSideButtonsContainerSpecify the side buttons container stylesStyle Object
styleButtonSpecify the default side button container stylesStyle Object
buttonSizeSpecify the side buttons size (default: 30)Number

Public methods

Method nameInfoParametersReturn
getPaginationGet current pagination status-{ currentIndex, pagination, total }
nextGo to the next screen--
prevGo to the previous screen--
goToIndexGo to the specified indexindex-

Keywords

react

FAQs

Package last updated on 19 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts