Coder Social home page Coder Social logo

mnaveeds / react-native-horizontal-picker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vdor/react-native-horizontal-picker

0.0 0.0 0.0 4.61 MB

Component for displaying horizontally scrolled picker for React Native

TypeScript 97.97% JavaScript 2.03%

react-native-horizontal-picker's Introduction

@vseslav/react-native-horizontal-picker

Component for displaying horizontally scrolled picker for React Native

platforms

Example

@vseslav/react-native-horizontal-picker

Usage

$ npm install --save @vseslav/react-native-horizontal-picker
import HorizontalPicker from '@vseslav/react-native-horizontal-picker';


const Items = Array.from(Array(100).keys());

const renderItem = (item, index) => (
  <View style={[styles.item], { width: 80 }}>
    <Text style={styles.itemText}>
      { item }
    </Text>
  </View>
);

export default function MyPicker() {
  return (
    <HorizontalPicker
      data={Items}
      renderItem={renderItem}
      itemWidth={80}
    />
  );
}

Props

Required

Prop Description Type Default
data Array of any items to loop on Array Required
renderItem Takes an item from data and renders it into the picker. The function receives one argument {item, index} and must return a React element. (item: any, index: number) => ReactNode Required
itemWidth Width in pixels of horizontal pickers's items, must be the same for all of them Number Required

Not Required

Prop Description Type Default
snapTimeout Number of millisecoonds. When user will drag to scroll, after this time picker will automatically scroll to nearest item Number 500
defaultIndex Default index of item. Must be `defaultIndex < data.length && defaultIndex > 0 null`
onChange Callback called when selected item is changed (position: number) => voiod null
animatedScrollToDefaultIndex Animate autoscroll to default index boolean false

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.