@@ -12,7 +12,6 @@ import {
1212 ViewStyle ,
1313 TextStyle ,
1414 LayoutChangeEvent ,
15- ImageStyle ,
1615} from "react-native" ;
1716import { withTheme } from "../theming" ;
1817import type { Theme } from "../styles/DefaultTheme" ;
@@ -235,6 +234,7 @@ class TextField extends React.Component<Props, State> {
235234
236235 render ( ) {
237236 const {
237+ theme : { colors, typography, roundness, disabledOpacity } ,
238238 Icon,
239239 type = "underline" ,
240240 disabled = false ,
@@ -248,11 +248,10 @@ class TextField extends React.Component<Props, State> {
248248 iconSize,
249249 assistiveText,
250250 underlineColor : underlineColorProp ,
251- activeBorderColor : activeBorderColorProp ,
251+ activeBorderColor : activeBorderColorProp = colors . primary ,
252252 multiline = false ,
253253 numberOfLines = 4 ,
254254 style,
255- theme : { colors, typography, roundness, disabledOpacity } ,
256255 render = ( props ) => < TextInput { ...props } /> ,
257256 ...rest
258257 } = this . props ;
@@ -297,9 +296,7 @@ class TextField extends React.Component<Props, State> {
297296 paddingVertical : 0 ,
298297 color : inputTextColor ,
299298 paddingLeft :
300- leftIconName && leftIconMode === "inset"
301- ? ICON_SIZE + 12 + ( type === "solid" ? 16 : 0 )
302- : 0 ,
299+ leftIconName && leftIconMode === "inset" ? ICON_SIZE + 12 : 0 ,
303300 paddingRight : rightIconName ? ICON_SIZE + 16 + 4 : 12 ,
304301 ...subtitle1 ,
305302 } ;
@@ -340,8 +337,6 @@ class TextField extends React.Component<Props, State> {
340337 } else {
341338 assistiveTextLeftMargin = 12 ;
342339 }
343-
344- inputStyle . paddingHorizontal = 12 ;
345340 }
346341
347342 if ( leftIconName && leftIconMode === "outset" ) {
@@ -359,30 +354,11 @@ class TextField extends React.Component<Props, State> {
359354 leftIconColor = colors . light ;
360355 }
361356
362- const leftIconProps = {
363- size : iconSize || 24 ,
364- color : leftIconColor ,
365- name : leftIconName || "" ,
366- } ;
367-
368- const leftIconStyle : ImageStyle = {
369- position : "absolute" ,
370- marginTop :
371- type === "solid"
372- ? MINIMIZED_LABEL_FONT_SIZE + 4
373- : leftIconMode === "outset"
374- ? 16
375- : 0 ,
376- marginLeft : leftIconMode === "inset" && type === "solid" ? 16 : 0 ,
377- } ;
378-
379357 const labelStyle = {
380358 ...typography . subtitle1 ,
359+ ...( type === "solid" ? { marginHorizontal : 12 } : { } ) ,
381360 top : type === "solid" ? 16 : 0 ,
382- left :
383- leftIconName && leftIconMode === "inset"
384- ? ICON_SIZE + ( type === "solid" ? 16 : 12 )
385- : 0 ,
361+ left : leftIconName && leftIconMode === "inset" ? ICON_SIZE + 12 : 0 ,
386362 transform : [
387363 {
388364 // Move label to top
@@ -425,7 +401,7 @@ class TextField extends React.Component<Props, State> {
425401 [
426402 styles . input ,
427403 inputStyle ,
428- type === "solid" ? { marginHorizontal : 12 } : { } ,
404+ type === "solid" ? { marginHorizontal : 16 } : { marginHorizontal : 6 } ,
429405 ] ,
430406 textStyles
431407 ) ;
@@ -449,9 +425,6 @@ class TextField extends React.Component<Props, State> {
449425
450426 return (
451427 < View style = { [ styles . container , styleProp ] } >
452- { leftIconName && leftIconMode === "outset" ? (
453- < Icon { ...leftIconProps } style = { leftIconStyle } />
454- ) : null }
455428 < View
456429 style = { applyStyles ( [ containerStyle ] , {
457430 height : styleProp . height ,
@@ -519,7 +492,6 @@ class TextField extends React.Component<Props, State> {
519492 }
520493 style = { [
521494 styles . placeholder ,
522- type === "solid" ? { paddingHorizontal : 12 } : { } ,
523495 labelStyle ,
524496 {
525497 color : placeholderColor ,
@@ -536,7 +508,6 @@ class TextField extends React.Component<Props, State> {
536508 < AnimatedText
537509 style = { [
538510 styles . placeholder ,
539- type === "solid" ? { paddingHorizontal : 12 } : { } ,
540511 labelStyle ,
541512 {
542513 color : placeholderColor ,
@@ -550,16 +521,6 @@ class TextField extends React.Component<Props, State> {
550521 </ View >
551522 ) : null }
552523
553- { leftIconName && leftIconMode === "inset" ? (
554- < View
555- style = { {
556- justifyContent : type === "solid" ? "center" : undefined ,
557- } }
558- >
559- < Icon { ...leftIconProps } style = { leftIconStyle } />
560- </ View >
561- ) : null }
562-
563524 { render ( {
564525 ref : ( c : NativeTextInput ) => {
565526 this . _root = c ;
@@ -583,6 +544,20 @@ class TextField extends React.Component<Props, State> {
583544 value : this . state . value ,
584545 } ) }
585546 </ View >
547+
548+ { leftIconName ? (
549+ < Icon
550+ size = { iconSize || ICON_SIZE }
551+ color = { leftIconColor || colors . light }
552+ name = { leftIconName }
553+ style = { {
554+ position : "absolute" ,
555+ left : leftIconMode === "inset" && type === "solid" ? 16 : 0 ,
556+ marginTop : type === "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16 ,
557+ } }
558+ />
559+ ) : null }
560+
586561 { rightIconName ? (
587562 < Icon
588563 name = { rightIconName }
0 commit comments