-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Token transitions color transition errors #457
Comments
Have found changing the see |
I think it's a problem with React reusing the elements for different tokens (and keeping the transition state). For example, forcing React to re-create all elements should fix it: export const tokenTransitions: AnnotationHandler = {
name: "token-transitions",
PreWithRef,
Token: (props) => (
<InnerToken
merge={props}
style={{ display: "inline-block" }}
key={Math.random()} // HACK
/>
),
} I'll try to find a good solution, ideally making React reset any token transition before calculating the new colors. |
This issue has been fixed but not yet released. Try it in your project before the release with:
Or wait for the next release. |
🚀 Released in If this was helpful, consider sponsoring Code Hike. Your contribution helps sustain open-source work. Thanks for using Code Hike! |
Hey, first this library is incredible.
I've noticed some odd behavior with colors when using token transitions, where the tokens end up the wrong color.
Here is an example recorded on the Scrollycoding page on the docs:
transitions-color-error.mp4
This is in Chrome, but the same occurs in Firefox and Safari.
I can see something similar on the Token Transitions page, where the opening parenthesis in
if (n == 0)
turns blue when switching from scala to python and back to scala.The strange thing is that if you inspect those elements, they have the correct color set on their inline style.
The text was updated successfully, but these errors were encountered: