Open haseebanwar opened 4 years ago
This also occurs with the following example given by documentation which uses a div inside of Typist. The same happens with p element. I suppose the cause of this problem is related to CSS display properties as h1, p and div have block as default value.
<Typist>
<span className="my-custom-class"> First Sentence </span>
<br />
<div className="container">
<p> This will be animated after first sentence is complete </p>
<MyComponent prop1="val1"> More text. </MyComponent>
</div>
Final sentence
</Typist>
One thing that I used to temporarily solve this is setting display property of the used element to inline-block.
By default
<Typist />
component produces adiv
element with classTypist
. If I want to animate a heading I need to put<Typist />
component insideh1
tag just like this:This will result in the following markup:
Now the above syntax has no issues everything works as it is supposed to but is it a good practice to put a
div
tag inside aheading
tag?To solve the above issue I tried to animate my heading in this way:
But this way does not animate the heading correctly and pushes the cursor to the next line instead of showing at the end of the text. The markup will be:
Is there any way to keep the functionality and animations without having to put the
div
insideheading
orparagraph
tags?Can we give a
porp
to<Typist />
component to produce aspan
element instead ofdiv
soh1
does not have adiv
inside of it.