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

Add missing displayName prop to createReactClass example #10122

Closed
wants to merge 1 commit into from

Conversation

hramos
Copy link
Contributor

@hramos hramos commented Jul 7, 2017

Without a displayName prop, snapshots generated by Jest would not contain the component name.

Before this change, a snapshot test might fail with a diff that looks like:

    -  <View>
    -    <View
    +  <>
    +    <
           onLayout={[Function]}
           style={null}
         >
           <item
             title="i0"
    @@ -47,12 +47,12 @@
               Object {
                 "key": "i0",
               }
             }
           />
    -    </View>
    -    <View
    +    </>
    +    <

After this change, the snapshot test referred above would not fail in this manner.

@javache
Copy link
Member

javache commented Jul 7, 2017

This is usually taken care of automatically by the babel-plugin-transform-react-display-name. Maybe we need to upgrade that so it knows about createReactClass ?

@gaearon
Copy link
Collaborator

gaearon commented Jul 7, 2017

Yes. You probably need to update the plugin.

@gaearon gaearon closed this Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants