diff --git a/index.js b/index.js index d65bf4c0..395a282f 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,7 @@ 'use strict'; -import React,{ - PropTypes -} from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import { View, @@ -12,28 +11,31 @@ import { Text, ScrollView, TouchableOpacity, - Platform + Platform, + ViewPropTypes } from 'react-native'; import styles from './style'; import BaseComponent from './BaseComponent'; let componentIndex = 0; +let rnVersion = Number.parseFloat(require('react-native/package.json').version); const propTypes = { data: PropTypes.array, onChange: PropTypes.func, initValue: PropTypes.string, - style: View.propTypes.style, - selectStyle: View.propTypes.style, - optionStyle: View.propTypes.style, + style: rnVersion >= 0.44 ? ViewPropTypes.style : View.propTypes.style, + selectStyle: rnVersion >= 0.44 ? ViewPropTypes.style : View.propTypes.style, + optionStyle: rnVersion >= 0.44 ? ViewPropTypes.style : View.propTypes.style, optionTextStyle: Text.propTypes.style, - sectionStyle: View.propTypes.style, + sectionStyle: rnVersion >= 0.44 ? ViewPropTypes.style : View.propTypes.style, sectionTextStyle: Text.propTypes.style, - cancelStyle: View.propTypes.style, + cancelStyle: rnVersion >= 0.44 ? ViewPropTypes.style : View.propTypes.style, cancelTextStyle: Text.propTypes.style, - overlayStyle: View.propTypes.style, - cancelText: PropTypes.string + overlayStyle: rnVersion >= 0.44 ? ViewPropTypes.style : View.propTypes.style, + cancelText: PropTypes.string, + keyboardShouldPersistTaps: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]) }; const defaultProps = { @@ -49,7 +51,8 @@ const defaultProps = { cancelStyle: {}, cancelTextStyle: {}, overlayStyle: {}, - cancelText: 'cancel' + cancelText: 'cancel', + keyboardShouldPersistTaps: 'always' }; export default class ModalPicker extends BaseComponent { @@ -131,7 +134,7 @@ export default class ModalPicker extends BaseComponent { return ( - + {options} diff --git a/package.json b/package.json index 16e1eba7..fff55b63 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,9 @@ "android", "react-component" ], + "dependencies": { + "prop-types": "^15.5.10" + }, "author": "Daniel Korger ", "contributors": [ {