From 57e2af24d429c15a8be50455f7f4ede4e4b64878 Mon Sep 17 00:00:00 2001 From: niclas Date: Mon, 12 Apr 2021 12:56:14 +0200 Subject: [PATCH] fixed cursor --- components/input/Input.jsx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/components/input/Input.jsx b/components/input/Input.jsx index d11273e..d328957 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -292,19 +292,25 @@ export class Input extends React.Component { let remaining = []; for (let i = 0; i < this.state.fullText.length; i++) - remaining.push( - {this.state.remainingText[i]} - ); + if (i !== 0) + remaining.push( + {this.state.remainingText[i]} + ); + else + remaining.push( + + {this.state.remainingText[i]} + + ); for (let i = 0; i < this.state.typedText.length; i++) { let value = this.state.typedText[i]; if (value !== this.state.fullText[i]) typed.push({this.state.fullText[i]}); - else { - if (this.state.index - 1 === i) - typed.push({value}); - else typed.push({value}); - } + else typed.push({value}); } return (