react-typist icon indicating copy to clipboard operation
react-typist copied to clipboard

React 18 support

Open NawarA opened this issue 3 years ago • 15 comments

Hey guys, seems the library acts crazy in React 18, spewing non-sense:

React 18.0.0: image

React 17.0.2: image

I saw in another issue someone mentioned animations may screw up in React 18, but I'm flagging the whole library doesnt work in React 18. How easy is this to patch?

NawarA avatar Apr 09 '22 18:04 NawarA

Looks like each character at index-i is being written more than once

NawarA avatar Apr 10 '22 23:04 NawarA

Seeing the same on react 18.0.0-alpha-cae635054-20210626

utxo-detective avatar Apr 15 '22 13:04 utxo-detective

it seems work in me

dellwatson avatar May 21 '22 22:05 dellwatson

Hi @NawarA. Did you find any way to fix it?

SavarJ avatar May 25 '22 20:05 SavarJ

Was anyone able to make this work?

jlubeck avatar May 27 '22 17:05 jlubeck

No, I didnt fix it. I was forced to use a different library

NawarA avatar Jun 02 '22 18:06 NawarA

No, I didnt fix it. I was forced to use a different library

Can you share which one did you use for React 18?

Thanks!

jlubeck avatar Jun 02 '22 20:06 jlubeck

No, I didnt fix it. I was forced to use a different library

Can you share which one did you use for React 18?

Thanks!

https://www.npmjs.com/package/react-typewriter

NawarA avatar Jun 08 '22 21:06 NawarA

I really like the way react-typist creates the typing animation, but it seems that this package is no longer updated. As a result, I create a new package and try to reproduce the functionality of react-typist. If you haven't find an alternative package, maybe you can give it a try.

Here is the package: https://www.npmjs.com/package/react-typist-component

jason89521 avatar Jun 15 '22 08:06 jason89521

I really like the way react-typist creates the typing animation, but it seems that this package is no longer updated. As a result, I create a new package and try to reproduce the functionality of react-typist. If you haven't find an alternative package, maybe you can give it a try.

Here is the package: https://www.npmjs.com/package/react-typist-component

Works like a breeze with React 18 and MUI, thank you!

echo-gravitas avatar Jul 02 '22 16:07 echo-gravitas

Amazing

Vinnie-tec avatar Oct 06 '22 12:10 Vinnie-tec

Remove StrictMode works fine for me

Beckem avatar Feb 21 '23 03:02 Beckem

Remove StrictMode works fine for me

Yup, strangely this solved the issue for me as well :thinking:

zapling avatar Mar 11 '23 15:03 zapling

I get this warning message when running without strict mode

componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: Cursor

zapling avatar Mar 11 '23 15:03 zapling

Still encountering the same error, and after trying several libraries, I'm now using react-simple-typewriter ("^5.0.1") and can achieve the same animation where certain sentences appear and then disappear. You can refer to the code below. Hope this can be of assistance with your issues too.

// 'react-typist' code
import Typist from 'react-typist';
import 'react-typist/dist/Typist.css';
.
.

const SomeComponent = () => {
.
.
return (
    <div>
     I am
      <div >
        <Typist className="inline" startDelay={1000}>
          sleepy
          <Typist.Backspace count={7} delay={1000} />
          hungry
          <Typist.Backspace count={7} delay={1000} />
          happy
        </Typist>
      </div>
    </div>
);
}

export default SomeComponent;
// 'react-simple-typewriter' code
import { useTypewriter, Cursor } from "react-simple-typewriter";
.
.

  const [text] = useTypewriter({
    words: ['sleepy', 'hungry', 'happy'],
  })


   <div>
     I am
      <div>
        {text}                  
        <Cursor cursorColor='red' />
      </div>
    </div>

Doyu-Lee avatar Sep 27 '23 10:09 Doyu-Lee