From 5c221dfec198b4682c73a3003693344e29bf4c26 Mon Sep 17 00:00:00 2001 From: Jan Rys Date: Thu, 16 Jun 2016 09:23:52 +0200 Subject: [PATCH 1/4] fixed undefined curItem in onValueChange method happened in case when the list of picker options was empty and I touched to scroll the Picker --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index cbef288..2fed2ca 100644 --- a/index.js +++ b/index.js @@ -205,7 +205,9 @@ export default class PickerAndroid extends Component{ //but PickerIOS only passed value, so we set label to be the second argument //add by zooble @2015-12-10 var curItem = this.state.items[this.index]; - this.state.onValueChange && this.state.onValueChange(curItem.value, curItem.label); + if (curItem && this.state.onValueChange) { + this.state.onValueChange(curItem.value, curItem.label); + } } render(){ From 5388a936c3b51adfc772e878c10183f03a32a434 Mon Sep 17 00:00:00 2001 From: Jan Rys Date: Wed, 28 Dec 2016 16:43:25 +0100 Subject: [PATCH 2/4] fix #13 #14 --- index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 2fed2ca..0b5df58 100644 --- a/index.js +++ b/index.js @@ -269,7 +269,8 @@ let styles = StyleSheet.create({ }, up: { height: 90, - overflow: 'hidden' + overflow: 'hidden', + backgroundColor: 'transparent', }, upView: { justifyContent: 'flex-start', @@ -291,7 +292,8 @@ let styles = StyleSheet.create({ overflow: 'hidden', borderColor: '#aaa', borderTopWidth: 1/ratio, - borderBottomWidth: 1/ratio + borderBottomWidth: 1/ratio, + backgroundColor: 'transparent', }, middleView: { height: 40, @@ -309,12 +311,14 @@ let styles = StyleSheet.create({ }, down: { height: 90, - overflow: 'hidden' + overflow: 'hidden', + backgroundColor: 'transparent', }, downView: { overflow: 'hidden', justifyContent: 'flex-start', - alignItems: 'center' + alignItems: 'center', + backgroundColor: 'transparent', }, downText: { paddingTop: 0, From 2f3bac45476297e5c8ed6f62c290f78462a1d43b Mon Sep 17 00:00:00 2001 From: Nicolas Charpentier Date: Tue, 24 Oct 2017 11:32:44 -0400 Subject: [PATCH 3/4] Move to prop-types dependency --- index.js | 3 ++- package.json | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 0b5df58..36c76ad 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ 'use strict'; -import React, {Component, PropTypes} from 'react'; +import React, { Component } from 'react'; import { StyleSheet, View, @@ -10,6 +10,7 @@ import { PixelRatio, PanResponder } from 'react-native'; +import PropTypes from "prop-types"; class PickerAndroidItem extends Component{ diff --git a/package.json b/package.json index b11f4fd..a9bd017 100644 --- a/package.json +++ b/package.json @@ -26,5 +26,8 @@ "bugs": { "url": "https://github.com/beefe/react-native-picker-android/issues" }, - "homepage": "https://github.com/beefe/react-native-picker-android#readme" + "homepage": "https://github.com/beefe/react-native-picker-android#readme", + "dependencies": { + "prop-types": "^15.6.0" + } } From 857e774b1169a97d40e3e8c719159837fa470e8c Mon Sep 17 00:00:00 2001 From: Nicolas Charpentier Date: Thu, 26 Oct 2017 13:29:15 -0400 Subject: [PATCH 4/4] Change deprecated View.propTypes to ViewPropTypes --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 36c76ad..863242a 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,8 @@ import { Image, Dimensions, PixelRatio, - PanResponder + PanResponder, + ViewPropTypes, } from 'react-native'; import PropTypes from "prop-types"; @@ -35,7 +36,7 @@ export default class PickerAndroid extends Component{ static propTypes = { //picker's style - pickerStyle: View.propTypes.style, + pickerStyle: ViewPropTypes.style, //picker item's style itemStyle: Text.propTypes.style, //picked value changed then call this function