diff --git a/.gitignore b/.gitignore index 85b13164..d6b73102 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea npm-debug.log +node_modules # vim *.sw* diff --git a/index.js b/index.js index d65bf4c0..58ff76dd 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,6 @@ 'use strict'; -import React,{ - PropTypes -} from 'react'; +import React from 'react'; import { View, @@ -15,6 +13,8 @@ import { Platform } from 'react-native'; +import PropTypes from 'prop-types'; + import styles from './style'; import BaseComponent from './BaseComponent'; @@ -38,7 +38,8 @@ const propTypes = { const defaultProps = { data: [], - onChange: ()=> {}, + onChange: () => { + }, initValue: 'Select me!', style: {}, selectStyle: {}, @@ -79,9 +80,9 @@ export default class ModalPicker extends BaseComponent { } componentWillReceiveProps(nextProps) { - if (nextProps.initValue != this.props.initValue) { - this.setState({selected: nextProps.initValue}); - } + if (nextProps.initValue != this.props.initValue) { + this.setState({selected: nextProps.initValue}); + } } onChange(item) { @@ -91,30 +92,30 @@ export default class ModalPicker extends BaseComponent { } close() { - this.setState({ - modalVisible: false - }); + this.setState({ + modalVisible: false + }); } open() { - this.setState({ - modalVisible: true - }); + this.setState({ + modalVisible: true + }); } renderSection(section) { return ( - - {section.label} + + {section.label} ); } renderOption(option) { return ( - this.onChange(option)}> + this.onChange(option)}> - {option.label} + {option.label} ) } @@ -129,10 +130,10 @@ export default class ModalPicker extends BaseComponent { }); return ( - + - + {options} @@ -140,7 +141,8 @@ export default class ModalPicker extends BaseComponent { - {this.props.cancelText} + {this.props.cancelText} @@ -150,7 +152,7 @@ export default class ModalPicker extends BaseComponent { renderChildren() { - if(this.props.children) { + if (this.props.children) { return this.props.children; } return ( @@ -163,9 +165,10 @@ export default class ModalPicker extends BaseComponent { render() { const dp = ( - - {this.renderOptionList()} - + + {this.renderOptionList()} + ); return ( diff --git a/package.json b/package.json index 16e1eba7..150b4a45 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,10 @@ "type": "git", "url": "https://github.com/d-a-n/react-native-modal-picker.git" }, + "dependencies": { + "react": "^16.0.0-alpha.12", + "prop-types": "^15.6.0" + }, "keywords": [ "react-native", "dropdown",