Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';

import React,{
PropTypes
} from 'react';
import React from 'react';
import PropTypes from 'prop-types';

import {
View,
Expand All @@ -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 = {
Expand All @@ -49,7 +51,8 @@ const defaultProps = {
cancelStyle: {},
cancelTextStyle: {},
overlayStyle: {},
cancelText: 'cancel'
cancelText: 'cancel',
keyboardShouldPersistTaps: 'always'
};

export default class ModalPicker extends BaseComponent {
Expand Down Expand Up @@ -131,7 +134,7 @@ export default class ModalPicker extends BaseComponent {
return (
<View style={[styles.overlayStyle, this.props.overlayStyle]} key={'modalPicker'+(componentIndex++)}>
<View style={styles.optionContainer}>
<ScrollView keyboardShouldPersistTaps>
<ScrollView keyboardShouldPersistTaps={this.props.keyboardShouldPersistTaps}>
<View style={{paddingHorizontal:10}}>
{options}
</View>
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"android",
"react-component"
],
"dependencies": {
"prop-types": "^15.5.10"
},
"author": "Daniel Korger <[email protected]>",
"contributors": [
{
Expand Down