Skip to content

Commit

Permalink
Fixed conditional rendering for Helper component
Browse files Browse the repository at this point in the history
  • Loading branch information
n4kz committed Mar 30, 2017
1 parent d637baa commit 7ee3786
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/field/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ export default class TextField extends Component {

<Animated.View style={helperContainerStyle}>
<View style={styles.flex}>
{error && <Helper style={errorStyle} text={error} />}
{title && <Helper style={titleStyle} text={title} />}
<Helper style={errorStyle} text={error} />
<Helper style={titleStyle} text={title} />
</View>

<Counter {...{ baseColor, errorColor, count, limit }} />
Expand Down
6 changes: 3 additions & 3 deletions src/components/helper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ export default class Helper extends Component {
};

static propTypes = {
text: PropTypes.string.isRequired,
text: PropTypes.string,
};

render() {
let { text, ...props } = this.props;

return (
return text? (
<View style={styles.container}>
<Animated.Text {...props}>{text}</Animated.Text>
</View>
);
) : null;
}
}

0 comments on commit 7ee3786

Please sign in to comment.