Socket
Book a DemoInstallSign in
Socket

react-native-animated-wheel-picker

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-animated-wheel-picker

A cross-platform wheel picker use Reanimted 2 implementation.

latest
Source
npmnpm
Version
1.1.3
Version published
Weekly downloads
11
-35.29%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-animated-wheel-picker

TypeScript Android IOS License: MIT

A cross-platform wheel picker use Reanimated 2 implementation.

Preview

Features

  • Smooth scroll animations
  • Custom text style, view style, mask component style
  • Animations built by react-native-reanimated

Installation

npm install react-native-animated-wheel-picker

or

yarn add react-native-animated-wheel-picker

Need to install peer dependencies react-native-reanimated, react-native-gesture-handler, @react-native-masked-view/masked-view.

Usage

import Picker from "react-native-animated-wheel-picker";

// ...
const DATA = [
  { title: '2022', value: 1 },
  { title: '2023', value: 2 },
  { title: '2024', value: 3 },
];

const WheelPicker = () => {
  const [year, setYear] = useState();
  return (
    <View style={{height:200}}>
      <Picker
        pickerData={DATA}
        textStyle={{ fontSize: 27 }}
        onSelected={(item) => setYear(item)}
      />
    </View>
  );
};

Props

Inherite ViewProps

NameTypeDefaultDescription
pickerData{"title":string,"value":any}REQUIREDData for each element "title" key display on picker item
itemHeightnumber30Height of each picker item
visiblenumber5Visible item on picker
initialIndexnumber0Set initial selected item
maskedComponentsJSX.Element or JSX.Element[]MaskedComponentThe component masked picker view
contentContainerStyleStyleProp<ViewStyle>undefinedItem view style
textStyleStyleProp<TextStyle>undefinedItem text style
onSelected({"title":string,"value":any},index:number) => voidREQUIREDCallback when user select item that will return element of pickerData array

MaskedComponent

<View>
  <View
    style={{
      height: itemHeight * Math.trunc(visible / 2),
      backgroundColor: 'grey',
    }}
  />

  <View style={{ height: itemHeight, backgroundColor: 'white' }} />
  <View
    style={{
      height: itemHeight * Math.trunc(visible / 2),
      backgroundColor: 'grey',
    }}
  />
</View>;

Credit

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Keywords

react-native

FAQs

Package last updated on 08 Aug 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