Skip to content

Commit

Permalink
fix: rn inputItem custom input color, close #1471
Browse files Browse the repository at this point in the history
  • Loading branch information
silentcloud committed Aug 8, 2017
1 parent 36c36b8 commit 54b0854
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
Expand Down Expand Up @@ -244,13 +245,12 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
},
Object {
"color": "#000000",
},
null,
]
}
textAlign="left"
Expand Down Expand Up @@ -319,13 +319,12 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
},
Object {
"color": "#000000",
},
null,
]
}
textAlign="left"
Expand Down Expand Up @@ -392,13 +391,12 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
},
Object {
"color": "#000000",
},
null,
]
}
textAlign="left"
Expand Down Expand Up @@ -463,13 +461,12 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
},
Object {
"color": "#000000",
},
null,
]
}
textAlign="left"
Expand Down Expand Up @@ -730,13 +727,12 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
},
Object {
"color": "#000000",
},
null,
]
}
textAlign="left"
Expand Down Expand Up @@ -801,13 +797,12 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
},
Object {
"color": "#000000",
},
null,
]
}
textAlign="left"
Expand Down Expand Up @@ -872,13 +867,12 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
},
Object {
"color": "#000000",
},
null,
]
}
textAlign="left"
Expand Down Expand Up @@ -993,6 +987,7 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
Expand Down Expand Up @@ -1098,13 +1093,12 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
},
Object {
"color": "#000000",
},
null,
]
}
textAlign="left"
Expand Down Expand Up @@ -1169,13 +1163,12 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
},
Object {
"color": "#000000",
},
null,
]
}
textAlign="left"
Expand Down Expand Up @@ -1240,13 +1233,12 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
},
Object {
"color": "#000000",
},
null,
]
}
textAlign="left"
Expand Down Expand Up @@ -1311,13 +1303,12 @@ exports[`renders ./components/input-item/demo/basic.native.tsx correctly 1`] = `
Array [
Object {
"backgroundColor": "transparent",
"color": "#000000",
"flex": 1,
"fontSize": 17,
"height": 44,
},
Object {
"color": "#000000",
},
null,
]
}
textAlign="left"
Expand Down
6 changes: 1 addition & 5 deletions components/input-item/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ export default class InputItem extends React.Component<InputItemProps, any> {
width: variables.font_size_heading * labelNumber * 1.05,
};

const inputStyle = {
color: error ? '#f50' : variables.color_text_base,
};

const extraStyle = {
width: typeof extra === 'string' && (extra as string).length > 0 ?
(extra as string).length * variables.font_size_heading : 0,
Expand Down Expand Up @@ -151,7 +147,7 @@ export default class InputItem extends React.Component<InputItemProps, any> {
underlineColorAndroid="transparent"
{...restProps}
{...valueProps}
style={[styles.input, inputStyle]}
style={[styles.input, error ? { color: '#f50' } : null]}
keyboardType={keyboardType}
onChange={(event) => this.onChange(event.nativeEvent.text)}
secureTextEntry={type === 'password'}
Expand Down
1 change: 1 addition & 0 deletions components/input-item/style/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default {
height: variables.list_item_height,
backgroundColor: 'transparent',
fontSize: variables.input_font_size,
color: variables.color_text_base,
},
extra: {
marginLeft: variables.h_spacing_sm,
Expand Down

0 comments on commit 54b0854

Please sign in to comment.