Skip to content

Conversation

comporell
Copy link

In case animation name starts with "-", parseSingle method breaks. this is just a simple workaround

In case animation name starts with "-", parseSingle method breaks. this is just a simple workaround
@cla-bot
Copy link

cla-bot bot commented Sep 14, 2022

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign the CLA at https://www.nativescript.org/cla.
CLA has not been signed by users: @comporell.
After signing the CLA, you can ask me to recheck this PR by posting @cla-bot check as a comment to the PR.

@comporell
Copy link
Author

@cla-bot check

@cla-bot cla-bot bot added the cla: yes label Sep 14, 2022
@cla-bot
Copy link

cla-bot bot commented Sep 14, 2022

The cla-bot has been summoned, and re-checked this pull request!

@comporell comporell changed the title Error:Invalid Unit workaround Error: InvalidUnit workaround Sep 14, 2022
@comporell comporell mentioned this pull request Sep 14, 2022
rigor789 added a commit that referenced this pull request Sep 26, 2022
@rigor789
Copy link
Member

Fixed it by catching the error & ignoring it instead. This workaround only prevented the error, but would introduce another issue... the animation would be renamed & never found if you removed the leading - from it's name. As for why this happens with the theme: https://github.com/NativeScript/theme/blob/15220c0f61fdd7d0bf25aaf9acaa215c69a8c128/src/scss/mixins/components/_button.scss#L221-L243

The $animation is set to "" by default, so ends up generating

animation: -hightlight-light .3s ease-out forwards;

Which is then treated as a number here: https://github.com/hookhookun/parse-animation-shorthand/blob/2a54be6c659115bced4f198d90fe7e3be884711b/src/parseSingleAnimationShorthand.ts#L52-L64

and throwing at the else condition.

@rigor789 rigor789 closed this Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants