Skip to content

Commit 12524c3

Browse files
Merge pull request #543 from shoutem/release/4.0.13
Release/4.0.13
2 parents 81b09cd + b4bc697 commit 12524c3

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

components/TextInput.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { PureComponent } from 'react';
22
import autoBindReact from 'auto-bind/react';
3-
import _ from 'lodash';
43
import PropTypes from 'prop-types';
54
import { TextInput as RNTextInput } from 'react-native';
65

@@ -10,16 +9,6 @@ import { connectStyle } from '@shoutem/theme';
109
import { Caption } from './Text';
1110
import { View } from './View';
1211

13-
// Style properties defined in theme which would case a warning if passed to a components style prop
14-
const omittedStyleProperties = [
15-
'errorBorder',
16-
'placeholderTextColor',
17-
'selectionColor',
18-
'underlineColorAndroid',
19-
'withBorder',
20-
'withoutBorder',
21-
];
22-
2312
class TextInput extends PureComponent {
2413
constructor(props) {
2514
super(props);
@@ -40,23 +29,40 @@ class TextInput extends PureComponent {
4029
}
4130

4231
render() {
43-
const { errorMessage, highlightOnFocus, style } = this.props;
32+
const {
33+
errorMessage,
34+
highlightOnFocus,
35+
style,
36+
...otherProps
37+
} = this.props;
4438
const { isFocused } = this.state;
4539

40+
const {
41+
errorBorderColor,
42+
placeholderTextColor,
43+
selectionColor,
44+
underlineColorAndroid,
45+
withBorder,
46+
withoutBorder,
47+
...otherStyle
48+
} = style;
49+
50+
const hasBorder = (isFocused && highlightOnFocus) || !!errorMessage;
51+
4652
return (
4753
<View>
4854
<RNTextInput
49-
{..._.omit(this.props, 'style')}
55+
{...otherProps}
5056
onBlur={this.handleBlur}
5157
onFocus={this.handleFocus}
5258
placeholderTextColor={style.placeholderTextColor}
5359
selectionColor={style.selectionColor}
5460
underlineColorAndroid={style.underlineColorAndroid}
55-
style={[
56-
_.omit(style, omittedStyleProperties),
57-
(isFocused && highlightOnFocus) ? style.withBorder : style.withoutBorder,
58-
!!errorMessage && style.errorBorder,
59-
]}
61+
style={{
62+
...otherStyle,
63+
...(hasBorder ? style.withBorder : style.withoutBorder),
64+
...(!!errorMessage ? style.errorBorderColor : {}),
65+
}}
6066
/>
6167
{!!errorMessage &&
6268
<Caption styleName="form-error sm-gutter-top">

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@shoutem/ui",
3-
"version": "4.0.12",
3+
"version": "4.0.13",
44
"description": "Styleable set of components for React Native applications",
55
"dependencies": {
66
"@shoutem/animation": "~0.12.4",

theme.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,8 +1967,7 @@ export default (variables = defaultThemeVariables) => ({
19671967
fontWeight: resolveFontWeight(variables.text.fontWeight),
19681968
fontStyle: resolveFontStyle(variables.text.fontStyle),
19691969

1970-
errorBorder: {
1971-
borderWidth: 1,
1970+
errorBorderColor: {
19721971
borderColor: variables.errorText.color,
19731972
},
19741973
withBorder: {

0 commit comments

Comments
 (0)