Skip to content

Commit 9f8f702

Browse files
committed
added possibility to change styles of input
new props will reset input value from store
1 parent b744909 commit 9f8f702

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/TextField.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export default class TextField extends Component {
2323
focus() {
2424
this.refs.input.focus();
2525
}
26+
componentWillReceiveProps(props) {
27+
this.setState({text: props.value})
28+
}
2629
render() {
2730
let {
2831
label,
@@ -34,13 +37,14 @@ export default class TextField extends Component {
3437
onBlur,
3538
onChangeText,
3639
value,
40+
style,
3741
dense,
3842
...props
3943
} = this.props;
4044
return (
4145
<View style={dense ? styles.denseWrapper : styles.wrapper} ref="wrapper">
4246
<TextInput
43-
style={dense ? styles.denseTextInput : styles.textInput}
47+
style={[dense ? styles.denseTextInput : styles.textInput, style]}
4448
onFocus={() => {
4549
this.setState({isFocused: true});
4650
this.refs.floatingLabel.floatLabel();
@@ -87,6 +91,7 @@ TextField.propTypes = {
8791
duration: PropTypes.number,
8892
label: PropTypes.string,
8993
highlightColor: PropTypes.string,
94+
style: PropTypes.any,
9095
onFocus: PropTypes.func,
9196
onBlur: PropTypes.func,
9297
onChangeText: PropTypes.func,

0 commit comments

Comments
 (0)