Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor jumps to next line when all items are looped again. #37

Open
tourajvaziri opened this issue Feb 1, 2019 · 1 comment
Open

Cursor jumps to next line when all items are looped again. #37

tourajvaziri opened this issue Feb 1, 2019 · 1 comment

Comments

@tourajvaziri
Copy link

This used to work in the version I was using before (1.3.3)
I updated to the version (1.6.2)
And now I have the issue.

Basically I have an array of strings. I go through each item and then I erase it (Backspace).
When it reaches the end of array, it loops back to the first item (loop = true) but then in the new version the cursor jumps to the next line. I have attached two screenshots for it.

This is also the code I am using:

import * as React from "react";
import "./Home.css";
const Typing = require("react-typing-animation").default;

interface HomeState {
names: string[];
}
class Home extends React.Component<any, HomeState> {
constructor(props: any) {
super(props);
this.state = {
names: ["item1", "item2"]
};
}

render() {
    let menuNames = [];
    for (var i = 0; i < this.state.names.length; i++) {
        menuNames.push(
            <div>
                <span>{this.state.names[i]}.</span>
                <Typing.Delay ms={1000} />
                <Typing.Backspace count={this.state.names[i].length + 1} />
            </div>
        );
    }
    return (
        <Typing loop="true" speed={100}>
            {menuNames}
        </Typing>
    );
}

}

export default Home;

new version: (bad)
newversion

old version: (good)
oldversion

@mayank
Copy link

mayank commented Jun 16, 2019

work around, add <Typing.Backspace count={1} /> in the start.

<Typing>
<Typing.Backspace count={1} />

....
</Typing>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants