Skip to content
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

Show proper error for transform in UAS #1832

Merged
merged 2 commits into from
Mar 16, 2021
Merged

Conversation

karol-bisztyga
Copy link
Contributor

Description

We want to handle a situation when a user forgets .value using transform in useAnimatedStyle:

const sv = useSharedValue(0);
const style = useAnimatedStyle(() => {
  return {
    transform: [{translateX: sv}],// should be sv.value
    width: sv,// should be sv.value
  };
});

For now, in such a case an uninformative error is being thrown.

src/reanimated2/Hooks.js Outdated Show resolved Hide resolved
src/reanimated2/Hooks.js Outdated Show resolved Hide resolved
@karol-bisztyga
Copy link
Contributor Author

I noticed it doesn't play along well with the fast refresh, maybe it's worth looking into it?

@karol-bisztyga karol-bisztyga marked this pull request as ready for review March 16, 2021 12:00
Copy link
Member

@piaskowyk piaskowyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it and everything works 💪

@piaskowyk piaskowyk merged commit 8bd0c98 into master Mar 16, 2021
@piaskowyk piaskowyk deleted the @karol/handle-transform-warn branch March 16, 2021 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants