quidone / react-native-wheel-picker

Wheel Picker for React Native
MIT License
23 stars 5 forks source link

React Native Wheel Picker

React Native Wheel Picker is released under the MIT license. Current npm package version.

A flexible React Native Wheel Picker for iOS and Android without using the native side.


On iOS

On Android

Customization

Features

Installation

yarn add @quidone/react-native-wheel-picker

Navigation

Usage

If you want to see more examples and experiment, run the examples locally.

git clone git@github.com:quidone/react-native-wheel-picker.git
cd react-native-wheel-picker
yarn install
cd example && yarn install && yarn ios

Simple case

import React, {useState} from 'react';
import WheelPicker from '@quidone/react-native-wheel-picker';

const data = [...Array(100).keys()].map((index) => ({
  value: index,
  label: index.toString(),
}))

const App = () => {
  const [value, setValue] = useState(0);
  return (
    <WheelPicker
      data={data}
      onValueChanged={({item: {value}}) => setValue(value)}
    />
  );
};

export default App;

Native Feedback

You can trigger native sound and impact with @quidone/react-native-wheel-picker-feedback and onValueChanging event

// ...
import WheelPickerFeedback from '@quidone/react-native-wheel-picker-feedback';

const App = () => {
  return (
    <WheelPicker
      onValueChanging={() => {
        WheelPickerFeedback.triggerSoundAndImpact();
      }}
    />
  );
};

API

WheelPicker

Props

usePickerItemHeight

This hook returns the item height which was passed via props.

useScrollContentOffset

This hook returns the animated value of the ScrollView offset.

withVirtualized

This HOC returns virtualized picker

import WheelPicker, {withVirtualized} from '@quidone/react-native-wheel-picker';

const VirtualizedWheelPicker = withVirtualized(WheelPicker);

Additional props

πŸ‘¨β€πŸ’» Author

Sergey Rozhkov

🎯 Was it helpful?

Do you like it and find it helpful? You can help this project in the following way:

🀝 Contributing

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

πŸ“„ License

Quidone React Native Wheel Picker is MIT licensed, as found in the LICENSE file.


Made with create-react-native-library