@@ -7,16 +7,16 @@ import Icon from 'react-native-vector-icons/Ionicons';
77import _ from 'lodash' ;
88import computeProps from '../../Utils/computeProps' ;
99import Input from './Input' ;
10- import InputLabel from './InputLabel' ;
1110
1211
13- export default class IconInput extends NativeBaseComponent {
12+ export default class InputGroup extends NativeBaseComponent {
1413
1514 getInitialStyle ( ) {
1615 return {
1716 textInput : {
1817 height : 40 ,
1918 backgroundColor : 'transparent' ,
19+ width : 20
2020 } ,
2121 outerBorder : {
2222 position :'relative' ,
@@ -68,29 +68,21 @@ export default class IconInput extends NativeBaseComponent {
6868 ( this . props . children . type == Icon ) ? this . getTheme ( ) . inputPaddingLeftIcon : this . getTheme ( ) . inputPaddingLeft
6969 }
7070
71+ var defaultStyle = ( this . props . borderType === 'regular' ) ? this . getInitialStyle ( ) . bordered : ( this . props . borderType === 'rounded' ) ? this . getInitialStyle ( ) . rounded : this . getInitialStyle ( ) . underline ;
72+
73+ type = _ . merge ( type , defaultStyle ) ;
7174
72- var addedProps = _ . merge ( this . getInitialStyle ( ) . textInput , type ) ;
75+ var addedProps = _ . merge ( this . getInitialStyle ( ) . textInput , type ) ;
7376
7477 var defaultProps = {
7578 style : addedProps
7679 }
7780
78- console . log ( "input style" , computeProps ( this . props , defaultProps ) ) ;
81+ console . log ( "input group style" , computeProps ( this . props , defaultProps ) ) ;
7982
8083 return computeProps ( this . props , defaultProps ) ;
8184
8285 }
83- renderLabel ( ) {
84- if ( ! Array . isArray ( this . props . children ) && this . props . children . type == InputLabel )
85- return this . props . children ;
86-
87- else
88- return _ . find ( this . props . children , function ( item ) {
89- if ( item && item . type == InputLabel ) {
90- return true ;
91- }
92- } ) ;
93- }
9486
9587 renderIcon ( ) {
9688 if ( ! Array . isArray ( this . props . children ) && this . props . children . type == Icon )
@@ -105,7 +97,7 @@ export default class IconInput extends NativeBaseComponent {
10597 }
10698
10799 renderInput ( ) {
108- if ( ! Array . isArray ( this . props . children ) && this . props . children . type == Input ) {
100+ if ( ! Array . isArray ( this . props . children ) && this . props . children . type == undefined ) {
109101 console . log ( 11111 ) ;
110102 var inputProps = { } ;
111103
@@ -117,7 +109,7 @@ export default class IconInput extends NativeBaseComponent {
117109 else {
118110 console . log ( 2222 ) ;
119111 var inp = _ . find ( this . props . children , function ( item ) {
120- if ( item && item . type == Input ) {
112+ if ( item && item . type == undefined ) {
121113 return true ;
122114 }
123115 } ) ;
@@ -136,10 +128,9 @@ export default class IconInput extends NativeBaseComponent {
136128
137129 render ( ) {
138130 return (
139- < View { ...this . prepareRootProps ( ) } style = { [ ( this . props . borderType === 'regular' ) ? this . getInitialStyle ( ) . bordered : ( this . props . borderType === 'rounded' ) ? this . getInitialStyle ( ) . rounded : this . getInitialStyle ( ) . underline ] } >
131+ < View { ...this . prepareRootProps ( ) } >
140132
141- { this . renderIcon ( ) }
142- { this . renderLabel ( ) }
133+ < Text > { this . renderIcon ( ) } </ Text >
143134 { this . renderInput ( ) }
144135 </ View >
145136 ) ;
0 commit comments