react-simple-typewriter icon indicating copy to clipboard operation
react-simple-typewriter copied to clipboard

hidding the cursor after a map item has been rendered.

Open king112ola opened this issue 1 year ago • 0 comments

Hello guys. I hope you are all doing well.

i would like to know if there is a short hand for disabling the cursor for a mapped component after the loop is done.

i have tried the onLoopDone function provided, but this won't work if the the typewriter is nested inside a continuously updating component.

For example,

const [cursorOn,setCursorOn]  = useState(true)

message.map(item=>{
return(
   <Typewriter cursor={cursorOn} onLoopDone={()=>setCursorOn(false)}>{item}</Typewriter>
)})

i thought of creating a cursor on off state for each component inside a map, but i hope there is an easier way that the cursor will be automatically disabled after the loop has been completed.

Apperciate it.

king112ola avatar Feb 27 '23 20:02 king112ola