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

@omerman/react-native-wheel-picker-android

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@omerman/react-native-wheel-picker-android

Simple Wheel Picker for Android to use with react-native

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by66.67%
Maintainers
1
Weekly downloads
 
Created
Source

ReactNativeWheelPicker

npm version npm version

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

Installation Android

  1. npm install @omerman/react-native-wheel-picker-android --save
  2. react-native link @omerman/react-native-wheel-picker-android
  3. In android/build.gradle add the jitpack repository to your project.
allprojects {
    repositories {
        ...
+       maven {
+          url "https://jitpack.io"
+       }
    }
}

Usage


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

class MyPickers extends Component {
  render() {
    let now = new Date()
    let wheelPickerData = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
    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)=>{console.log(event)}}
          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
itemTextAligncenterstring (left/right/center)Wheel Picker's text alignment
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() {
    let minutesArray = ['00', '15', '30', '45'];
    let 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

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 Earlest date
daysCount365numberHow many days included in Date Picker

Questions or suggestions?

Feel free to open an issue

Keywords

FAQs

Package last updated on 23 Dec 2017

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