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

react-native-wheel-picker-android

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-wheel-picker-android

Simple Wheel Picker for Android to use with react-native

  • 1.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10K
decreased by-11.39%
Maintainers
1
Weekly downloads
 
Created
Source

ReactNativeWheelPicker

A simple Wheel Picker for Android based on https://github.com/AigeStudio/WheelPicker Also you can use multiple pickers, such as DatePicker or TimePicker

For IOS you can use a good Picker for IOS and DatePicker for IOS

Installation Android

yarn add react-native-wheel-picker-android

react-native link react-native-wheel-picker-android

Usage


import { WheelPicker, DatePicker, TimePicker } from 'react-native-wheel-picker-android'
import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';

const wheelPickerData = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday','Saturday'];
const now = new Date()

class MyPickers extends Component {
  render() {
    return (
      <View style={styles.container}>
        <WheelPicker
           onItemSelected={(event)=>this.onItemSelected(event)}
           isCurved
           data={wheelPickerData}
           style={styles.wheelPicker}/>
         <DatePicker
           initDate={now.toISOString()}
           onDateSelected={(date)=>this.onDateSelected(date)}/>
         <TimePicker
           initDate={now.toISOString()}
           onTimeSelected={(date)=>this.onTimeSelected(date)}/>
      </View>
    );
  }

  onItemSelected(event){
    // do something
  }

  onDateSelected(date){
    // do something
  }

  onTimeSelected(date){
    // do something
  }


}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
  },
  wheelPicker: {
    width: 200,
    height: 150
  }
});

module.exports = MyPickers;

Wheel Picker


import { WheelPicker, DatePicker, TimePicker } from 'react-native-wheel-picker-android'
...

  render() {
    let arr = [1,2,3];
    return (
      <WheelPicker
          onItemSelected={(event)=>{/* do something */}}
          isCurved
          isCyclic
          data={arr}
          style={{width:300, height: 300}}/>
    );
  }

Props

PropDefaultTypeDescription
onItemSelectednullfuncCallback when user select item {data: 'itemData', position: 'itemPosition'}
datadefault string arrayarrayData array (string or number type)
isCurvedfalseboolMake Wheel Picker curved
isCyclicfalseboolMake Wheel Picker cyclic
isAtmosphericfalseboolDesign Wheel Picker's items
selectedItemTextColorgreystringWheel Picker's selected Item Text Color
itemSpace20numberWheel Picker's items spacing
visibleItemCount7numberWheel Picker's items max visible count
renderIndicatorfalseboolShow Wheel Picker indicator
indicatorColortransparentstringIndicator color
isCurtainfalseboolWheel Picker curtain
curtainColortransparentstringWheel Picker curtain color
itemTextColorgreystringWheel Picker's items color
itemTextSize20numberWheel Picker's items text size
itemTextFontFamilynullstringWheel Picker's items text font name
selectedItemPositionnullnumberSelect current item position
backgroundColortransparentstringWheel Picker background color

data

An array of options. This should be provided with an array of strings or array of numbers.

onItemSelected(event)

Callback with event in the form event = { data: 1, position: 0 }

Time Picker


...

  render() {
    const minutesArray = ['00', '15', '30', '45'];
    const now = new Date();
    return (
      	<TimePicker
	       minutes={minutesArray}
   	     onTimeSelected={(date)=>this.onTimeSelected(date))}
	       initDate={now.toISOString()}/>
    );
  }

  onTimeSelected(date){
    // do something
  }

Props

PropDefaultTypeDescription
onTimeSelectednullfuncCallback when user select time {date: 'selectedTime'}
initDatecurrent dateISOStringInitial selected time
hours[1, 2, 3, .. 12]arrayhours array
minutes['00', '05' ,'10', .. '55']arrayminutes array
itemTextColorgreystringTime Picker's items color
selectedItemTextColorblackstringTime Picker's selected Item Text Color
backgroundColor-stringTime Picker background color

Date Picker


...

  render() {
  let now = new Date();
    return (
      	<DatePicker
          initDate={now.toISOString()}
          onDateSelected={(date)=> this.onDateSelected(date)}/>
    );
  }

  onDateSelected(date){
    // do something
  }

Props

PropDefaultTypeDescription
onDateSelectednullfuncCallback when user select date {date: 'selectedDate'}
initDatecurrent dateISOStringInitial selected date
days['Today', 'Wed Dec 28', ...]arraydays array
hours[1, 2, 3 .. 12]arrayhours array
minutes['00', '05', '10', .. '55']arrayminutes array
format24falseboolif true hours format is 24 hours
startDatecurrent dateISOStringThe Earliest date
daysCount365numberHow many days included in Date Picker
itemTextColorgreystringDate Picker's items color
selectedItemTextColorblackstringDate Picker's selected Item Text Color
backgroundColor-stringDate Picker background color
hideDate-booleanHide date wheel picker
hideHours-booleanHide hours wheel picker
hideMinutes-booleanHide minutes wheel picker
hideAM-booleanHide AM wheel picker

Questions or suggestions?

Feel free to open an issue

Keywords

FAQs

Package last updated on 04 Jan 2019

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