New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-infinite-wheel-picker

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-infinite-wheel-picker

React Native component to provide infinite wheel picker selection

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
299
decreased by-35.42%
Maintainers
0
Weekly downloads
 
Created
Source

Infinite Wheel Picker - Simform

react-native-infinite-wheel-picker

react-native-infinite-wheel-picker on npm react-native-infinite-wheel-picker downloads react-native-infinite-wheel-picker install size Android iOS MIT


The React Native Infinite Wheel Picker package offers a highly customizable, versatile, and seamless wheel picker component, enhancing the user experience with smooth scrolling and intuitive selection. It's dynamic design allows for endless scrolling, providing a natural and interactive interface for selecting values.

The library is compatible with both Android and iOS platforms, offering a versatile solution to elevate your app's user interface with ease.

🎬 Preview

SimformSolutionsSimformSolutions SimformSolutions

Quick Access

Installation | Usage and Examples | Properties | Example Code | License

Getting Started

Here's how to get started with react-native-infinite-wheel-picker in your React Native project:

Installation

Install the package
npm install react-native-infinite-wheel-picker

Using Yarn:

yarn add react-native-infinite-wheel-picker

Usage

import React from 'react';
import { StyleSheet, View } from 'react-native';
import { WheelPicker } from 'react-native-infinite-wheel-picker';

const App: React.FC = () => {
  const initialData = [1, 2, 3, 4, 5, 6, 7, 8];
  const [selectedIndex, setSelectedIndex] = React.useState(3);

  return (
    <View style={styles.container}>
      <WheelPicker
        initialSelectedIndex={3}
        data={initialData}
        restElements={2}
        elementHeight={30}
        onChangeValue={(index, value) => {
          console.log(value);
          setSelectedIndex(index);
        }}
        selectedIndex={selectedIndex}
        containerStyle={styles.containerStyle}
        selectedLayoutStyle={styles.selectedLayoutStyle}
        elementTextStyle={styles.elementTextStyle}
      />
    </View>
  );
};

export default App;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: '#fff',
    alignItems: 'center',
  },
  selectedLayoutStyle: {
    backgroundColor: '#00000026',
    borderRadius: 2,
  },
  containerStyle: { 
    backgroundColor: '#0000001a', 
    width: 150 
  },
  elementTextStyle: { 
    fontSize: 18 
  },
});

🎬 Preview

SimformSolutions

For, a simple scroll use infiniteScroll={false} that disable infinite scrolling of the items.

<WheelPicker
  initialSelectedIndex={3}
  data={initialData}
  restElements={2}
  elementHeight={30}
  onChangeValue={value => {
    console.log(value);
  }}
  infiniteScroll={false}
  selectedIndex={selectedIndex}
  containerStyle={styles.containerStyle}
  selectedLayoutStyle={styles.selectedLayoutStyle}
  elementTextStyle={styles.elementTextStyle}
/>;

🎬 Preview

SimformSolutions

Properties

PropsDefaultTypeDescription
data-Array<string> or Array<number>An array of strings or numbers representing the items to be displayed. eg [1, 2, 3, 4, 5, 6, 7, 8]
onChangeValue-functionA callback function invoked when the selected item changes, receiving the new value
selectedIndex-numberThe item that should be selected in the picker
initialSelectedIndex0number or stringThe item that should be pre-selected in the picker
infiniteScrolltruebooleanA boolean that enables or disables infinite scrolling of the items
restElements2numberThe number of items to show above and below the selected item in the picker
loopCount100numberThe number of times data array is repeated in picker
decelerationRate'fast''normal', 'fast', 'numberDetermines how quickly the scroll decelerates after the user lifts their finger in the picker
elementHeight40numberThe height of each item in the picker, in pixels
elementTextStyle-StyleProp<TextStyle>Style applied to the text of each item in the picker
elementContainerStyle-StyleProp<ViewStyle>Style applied to the container of each item in the picker
selectedLayoutStyle-StyleProp<ViewStyle>Style applied to the container of the selected item
containerStyle-StyleProp<ViewStyle>Style applied to the container of the wheel picker
containerProps-ViewPropsProps applied to the container of the wheel picker
flatListProps-FlatListPropsProps applied to the flatlist of the wheel picker
Know more about ViewProps, ViewStyle, FlatListProps, TextStyle, decelerationRate

Note: In case of a manual prop change, make sure to reload the application to see the changes in the component.

WheelPickerRef Methods
scrollToIndex()
scrollToIndex(index: number): void

scrollToIndex function that scroll to particular index.

Example

A full working example project is here Example

yarn
yarn example ios   // For ios
yarn example android   // For Android

Find this library useful? ❤️

Support it by joining stargazers for this repository.⭐

Bugs / Feature requests / Feedbacks

For bugs, feature requests, and discussion please use GitHub Issues, GitHub New Feature, GitHub Feedback

🤝 How to Contribute

We'd love to have you improve this library or fix a problem 💪 Check out our Contributing Guide for ideas on contributing.

Awesome Mobile Libraries

License

Keywords

FAQs

Package last updated on 07 Aug 2024

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