File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ export default class TextField extends Component {
2323 focus ( ) {
2424 this . refs . input . focus ( ) ;
2525 }
26+ componentWillReceiveProps ( props ) {
27+ if ( ! this . state . isFocused ) {
28+ this . setState ( { text : props . value } )
29+ }
30+ }
2631 render ( ) {
2732 let {
2833 label,
@@ -34,13 +39,14 @@ export default class TextField extends Component {
3439 onBlur,
3540 onChangeText,
3641 value,
42+ style,
3743 dense,
3844 ...props
3945 } = this . props ;
4046 return (
4147 < View style = { dense ? styles . denseWrapper : styles . wrapper } ref = "wrapper" >
4248 < TextInput
43- style = { dense ? styles . denseTextInput : styles . textInput }
49+ style = { [ dense ? styles . denseTextInput : styles . textInput , style ] }
4450 onFocus = { ( ) => {
4551 this . setState ( { isFocused : true } ) ;
4652 this . refs . floatingLabel . floatLabel ( ) ;
@@ -87,6 +93,7 @@ TextField.propTypes = {
8793 duration : PropTypes . number ,
8894 label : PropTypes . string ,
8995 highlightColor : PropTypes . string ,
96+ styles : PropTypes . any ,
9097 onFocus : PropTypes . func ,
9198 onBlur : PropTypes . func ,
9299 onChangeText : PropTypes . func ,
You can’t perform that action at this time.
0 commit comments