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

Better error messages when using Animated.Code #239

Merged
merged 3 commits into from
Apr 10, 2019

Conversation

hrastnik
Copy link
Contributor

@hrastnik hrastnik commented Apr 9, 2019

Added improved error messages to Animated.Code when wrong props are passed to the component. Also, unified the types both the exec and children can accept. Both exec and children can now accept a node or a function returning a node.

Example:

const node = block([...]);
const nodeFn = () => node;
// All of the following lines are now valid
<Animated.Code exec={node} />
<Animated.Code exec={nodeFn} />
<Animated.Code>{node}</Animated.Code>
<Animated.Code>{nodeFn}</Animated.Code>

I've created some tests to assert the error is being thrown when wrong prop types are provided. I've create a separate suite for testing Animated* components. I'm not really skilled in writing tests so this might be wrong.

Also, I've added the jsx-uses-react eslint rule to prevent false negatives when React is imported without using it directly, as JSX is using React implicitly. More info here: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md

Add improved error messages to Animated.Code when wrong props are passed
to the component. Also, unified the types both the exec and children can
accept. Both exec and children can now accept a node or a function
returning a node.
Created some tests to assert the error is being thrown when wrong prop
types are provided. Created a separate suite for testing Animated*
components.
Added jsx-uses-react eslint rule to prevent false unused-import errors
when React is imported and used through JSX.
Copy link
Contributor

@osdnk osdnk left a comment

Choose a reason for hiding this comment

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

Thanks!

@osdnk osdnk merged commit c39e672 into software-mansion:master Apr 10, 2019
RobertWHurst pushed a commit to hailogroup/react-native-reanimated that referenced this pull request Oct 28, 2022
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