Skip to content

Commit

Permalink
allow for null value iconElement
Browse files Browse the repository at this point in the history
  • Loading branch information
andersr committed Sep 26, 2016
1 parent eb2e79a commit 94c7913
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Components/Widgets/InputGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export default class InputGroup extends NativeBaseComponent {
}

prepareRootProps() {

var type = {
paddingLeft: (this.props.borderType === 'rounded' && !this.props.children.type == Icon) ? 15 :
(this.props.children.type == Icon ) ? this.getTheme().inputPaddingLeftIcon : 5
Expand All @@ -89,7 +88,6 @@ export default class InputGroup extends NativeBaseComponent {
}

getIconProps(icon) {

var defaultStyle = {
fontSize: (this.props.toolbar || this.props.atoolbar) ? this.getTheme().toolbarIconSize : 27,
alignSelf: 'center',
Expand Down Expand Up @@ -126,10 +124,10 @@ export default class InputGroup extends NativeBaseComponent {


renderChildren() {

var inputProps = {};
var newChildren = [];
var childrenArray = React.Children.toArray(this.props.children);
console.log('childrenArray: ', this.props.children)

var iconElement = [];
iconElement = _.remove(childrenArray, function(item) {
Expand Down Expand Up @@ -166,7 +164,7 @@ export default class InputGroup extends NativeBaseComponent {

if(Array.isArray(this.props.children)) {

if(this.props.iconRight) {
if(this.props.iconRight && iconElement.length > 0) {
if(clonedInp) {
newChildren.push(clonedInp);
}
Expand Down Expand Up @@ -211,7 +209,9 @@ export default class InputGroup extends NativeBaseComponent {
}
));
} else {
newChildren.push(React.cloneElement(iconElement[0], this.getIconProps(iconElement[0])));
if(iconElement.length > 0){
newChildren.push(React.cloneElement(iconElement[0], this.getIconProps(iconElement[0])));
}
if(clonedInp) {
newChildren.push(clonedInp);
}
Expand Down

0 comments on commit 94c7913

Please sign in to comment.