Skip to content

Commit a4b62f3

Browse files
authored
Merge pull request #33 from dallin-christensen/backspace-fix
Fix #28 "Texts are not getting erased"
2 parents cb895c8 + 7553f7a commit a4b62f3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Typing.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class Typing extends Component {
5252

5353
resetState = async () =>
5454
this.updateState({
55-
text: [],
5655
toType: extractText(this.props.children),
5756
cursor: {
5857
lineNum: 0,
@@ -194,12 +193,11 @@ class Typing extends Component {
194193

195194
render() {
196195
const { children, className, cursorClassName, hideCursor } = this.props;
197-
const { isFinished } = this.state;
196+
const { isFinished, text } = this.state;
198197

199198
const cursor = this.props.cursor || <Cursor className={cursorClassName} />;
200-
const filled = isFinished
201-
? children
202-
: replaceTreeText(children, this.state.text, cursor, hideCursor);
199+
200+
const filled = replaceTreeText(children, text, cursor, isFinished || hideCursor)
203201

204202
return <div className={className}>{filled}</div>;
205203
}

0 commit comments

Comments
 (0)