Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-wheely

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-wheely

An all JavaScript, highly customizable wheel picker for react-native.

  • 0.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20K
increased by7.75%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-wheely

CircleCI npm package npm downloads

An all JavaScript, highly customizable wheel picker for react native.

Installation

Install with npm

npm install --save react-native-wheely

Install with yarn

yarn add react-native-wheely

Usage

import React, { useState } from 'react';
import WheelPicker from 'react-native-wheely';

function CityPicker() {
  const [selectedIndex, setSelectedIndex] = useState(0);

  return (
    <WheelPicker
      selectedIndex={selectedIndex}
      options={['Berlin', 'London', 'Amsterdam']}
      onChange={(index) => setSelectedIndex(index)}
    />
  );
}

Props

NameTypeDescription
optionsstring[]Options to be displayed in the wheel picker. Options are rendered from top to bottom, meaning the first item in the options will be at the top and the last at the bottom.
selectedIndexnumberIndex of the currently selected option.
onChange(index: number) => voidHandler that is called when the selected option changes.
visibleRestnumberAmount of additional options that are visible in each direction. Default is 2, resulting in 5 visible options.
itemHeightnumberHeight of each option in the picker. Default is 40.
itemStyleStyleProp<ViewStyle>Style for the option's container.
itemTextStyleStyleProp<TextStyle>Style for the option's text.
containerStyleStyleProp<ViewStyle>Style of the picker.
selectedIndicatorStyleStyleProp<ViewStyle>Style of overlaying selected-indicator in the middle of the picker.
rotationFunction(x: number) => number Function to determine the x rotation of items based on their current distance to the center (which is x). Default is rotation equation
scaleFunction(x: number) => number Function to determine the scale of items based on their current distance to the center (which is x). Default is scale quation
opacityFunction(x: number) => numberFunction to determine the opacity of items based on their current distance to the center (which is x). Default is opacity equation
decelerationRate"normal", "fast", numberHow quickly the underlying scroll view decelerates after the user lifts their finger. See the ScrollView docs. Default is "fast".
containerPropsViewPropsProps that are applied to the container which wraps the FlatList and the selected indicator.
flatListPropsFlatListPropsProps that are applied to the FlatList.

Memoization

The individual items in the picker (<WheelPickerItem />) are strictly memoized, meaning that they will not rerender after the initial render. Rerendering the picker items uncontrollably would lead to bad performance with large number of options. Item styles, animation functions and other parameters of items therefore must be static and changes to them after the initial render will have no effect.

Keywords

FAQs

Package last updated on 13 Nov 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc