Skip to content

Commit 42bb59d

Browse files
committed
🐛 inputStyle doesn't work with classNames
1 parent 5499118 commit 42bb59d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-otp-input",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"description": "A fully customizable, one-time password input component for the web built with React",
55
"main": "lib/index.js",
66
"scripts": {

src/lib/index.jsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ class SingleOtpInput extends PureComponent<*> {
6363
}
6464
}
6565

66-
getClasses = (...classes) => classes.filter(c => !isStyleObject(c) && c !== false).join(' ');
66+
getClasses = (...classes) =>
67+
classes.filter(c => !isStyleObject(c) && c !== false).join(' ');
6768

6869
render() {
6970
const {
@@ -89,12 +90,13 @@ class SingleOtpInput extends PureComponent<*> {
8990
<input
9091
style={Object.assign(
9192
{ width: '1em', textAlign: 'center' },
92-
inputStyle,
93+
isStyleObject(inputStyle) && inputStyle,
9394
focus && isStyleObject(focusStyle) && focusStyle,
9495
isDisabled && isStyleObject(disabledStyle) && disabledStyle,
9596
hasErrored && isStyleObject(errorStyle) && errorStyle
9697
)}
9798
className={this.getClasses(
99+
inputStyle,
98100
focus && focusStyle,
99101
isDisabled && disabledStyle,
100102
hasErrored && errorStyle
@@ -275,7 +277,13 @@ class OtpInput extends Component<Props, State> {
275277
const { containerStyle } = this.props;
276278

277279
return (
278-
<div style={Object.assign({ display: 'flex' }, isStyleObject(containerStyle) && containerStyle )} className={!isStyleObject(containerStyle) && containerStyle}>
280+
<div
281+
style={Object.assign(
282+
{ display: 'flex' },
283+
isStyleObject(containerStyle) && containerStyle
284+
)}
285+
className={!isStyleObject(containerStyle) && containerStyle}
286+
>
279287
{this.renderInputs()}
280288
</div>
281289
);

0 commit comments

Comments
 (0)