1.1.3 • Published 2 years ago

react-native-animated-wheel-picker v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

1.1.3

2 years ago

1.1.2

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago