diff --git a/examples/CustomPicker/ModalPickerImage/index.js b/examples/CustomPicker/ModalPickerImage/index.js index 946ba7cd..d9a94dd5 100644 --- a/examples/CustomPicker/ModalPickerImage/index.js +++ b/examples/CustomPicker/ModalPickerImage/index.js @@ -1,7 +1,7 @@ import React from 'react'; -import { View, Modal, Text, ScrollView, TouchableOpacity, Image } from 'react-native'; +import { View, Modal, Text, ScrollView, TouchableOpacity, Image, ViewPropTypes } from 'react-native'; import PropTypes from 'prop-types'; @@ -14,16 +14,16 @@ const propTypes = { data: PropTypes.array, onChange: PropTypes.func, initValue: PropTypes.string, - style: View.propTypes.style, - selectStyle: View.propTypes.style, - optionStyle: View.propTypes.style, + style: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, + selectStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, + optionStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, optionTextStyle: Text.propTypes.style, - sectionStyle: View.propTypes.style, + sectionStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, sectionTextStyle: Text.propTypes.style, - cancelStyle: View.propTypes.style, + cancelStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, cancelTextStyle: Text.propTypes.style, - overlayStyle: View.propTypes.style, - cancelText: PropTypes.string, + overlayStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, + cancelText: PropTypes.string }; const defaultProps = { diff --git a/lib/index.js b/lib/index.js index 8f54405a..752cd283 100644 --- a/lib/index.js +++ b/lib/index.js @@ -57,8 +57,8 @@ export default class PhoneInput extends Component { onChangePhoneNumber(number) { const actionAfterSetState = this.props.onChangePhoneNumber ? () => { - this.props.onChangePhoneNumber(number); - } + this.props.onChangePhoneNumber(number); + } : null; this.updateFlagAndFormatNumber(number, actionAfterSetState); } @@ -100,7 +100,7 @@ export default class PhoneInput extends Component { } getValue() { - return this.state.formattedNumber.replace(/\s/g,''); + return this.state.formattedNumber.replace(/\s/g, ''); } getNumberType() { @@ -181,17 +181,25 @@ export default class PhoneInput extends Component { render() { const { iso2, inputValue, disabled } = this.state; const TextComponent = this.props.textComponent || TextInput; + const FlagSource = Flags.get(iso2); return ( - + { + !!FlagSource ? ( + + ) : + + }