Skip to content

Commit a635f97

Browse files
hantrongbinhapollonian
authored andcommitted
fix warning when className has undefined value
1 parent 9931449 commit a635f97

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/lib/index.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ class OtpInput extends Component<Props, State> {
131131
activeInput: 0,
132132
};
133133

134-
getOtpValue = () => (
135-
this.props.value ? this.props.value.toString().split('') : []
136-
);
134+
getOtpValue = () =>
135+
this.props.value ? this.props.value.toString().split('') : [];
137136

138137
// Helper to return OTP from input
139138
handleOtpChange = (otp: string[]) => {
@@ -222,7 +221,7 @@ class OtpInput extends Component<Props, State> {
222221
e.preventDefault();
223222
this.focusNextInput();
224223
}
225-
}
224+
};
226225

227226
renderInputs = () => {
228227
const { activeInput } = this.state;
@@ -282,7 +281,7 @@ class OtpInput extends Component<Props, State> {
282281
{ display: 'flex' },
283282
isStyleObject(containerStyle) && containerStyle
284283
)}
285-
className={!isStyleObject(containerStyle) && containerStyle}
284+
className={!isStyleObject(containerStyle) ? containerStyle : ''}
286285
>
287286
{this.renderInputs()}
288287
</div>

0 commit comments

Comments
 (0)