diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..6683f552 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +he MIT License (MIT) + +Copyright (c) 2016 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/WheelPicker.js b/WheelPicker.js new file mode 100644 index 00000000..f0fab98d --- /dev/null +++ b/WheelPicker.js @@ -0,0 +1,66 @@ +import React, { Component, PropTypes } from 'react'; +import { requireNativeComponent, DeviceEventEmitter,View } from 'react-native'; + +var WheelPickerView = requireNativeComponent('WheelPicker', WheelPicker); +class WheelPicker extends React.Component { + constructor() { + super(); + this.onItemSelected = this.onItemSelected.bind(this); + } + componentWillMount() { + DeviceEventEmitter.addListener('itemSelected', this.onItemSelected); + } + + componentWillUnmount() { + DeviceEventEmitter.removeListener('itemSelected', this.onItemSelected); + } + onItemSelected(event) { + if (this.props.onItemSelected) { + this.props.onItemSelected(event); + } + } + + render() { + return ( + + ); + } +} +WheelPicker.propTypes = { + ...View.propTypes, + onItemSelected: PropTypes.func, + data: PropTypes.array, + isCurved: PropTypes.bool, + isCyclic: PropTypes.bool, + isAtmospheric: PropTypes.bool, + selectedItemTextColor: PropTypes.string, + itemSpace: PropTypes.number, + visibleItemCount: PropTypes.number, + renderIndicator: PropTypes.bool, + indicatorColor: PropTypes.string, + isCurtain: PropTypes.bool, + curtainColor: PropTypes.string, + itemTextColor: PropTypes.string, + itemTextSize: PropTypes.number, + selectedItemPosition: PropTypes.number, + backgroundColor: PropTypes.string, +}; +module.exports = WheelPicker; diff --git a/package.json b/package.json new file mode 100644 index 00000000..789c7749 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "react-native-wheel-picker-android", + "version": "0.0.12", + "description": "Simple Wheel Picker for Android to use with react-native", + "main": "WheelPicker.js", + "repository": { + "type": "git", + "url": "https://github.com/ElekenAgency/ReactNativeWheelPicker" + }, + "keywords": [ + "react-component", + "react-native", + "android", + "picker", + "wheel-picker" + ], + "author": "Artem Kosiakevych ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ElekenAgency/ReactNativeWheelPicker/issues" + }, + "homepage": "https://github.com/ElekenAgency/ReactNativeWheelPicker" +}