question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support referenced and imported propTypes

See original GitHub issue

givent

import React from 'react';

const user = React.PropTypes.shape({
  email_address: React.PropTypes.string,
  name: React.PropTypes.string,
})

export default class Foobar extends React.Component {
  static propTypes = {
    a1: user,
    a2: React.PropTypes.shape({
      email_address: React.PropTypes.string,
      name: React.PropTypes.string,
    })
  };
  render() { return (<p>.</p>); }
};

the a1 field is renders to ‘No Control available’ while a2 appropriately renders the expected form.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tmccommented, Jun 17, 2016

@fkling / @nikgraf that does appear to fix this, FWIW

1reaction
nikgrafcommented, Jun 14, 2016

@fkling cool, thx for the hint. I will look into it later this week and create a PR 😊

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add support for imported propTypes · Issue #33 - GitHub
Importing prop types is a fairly common use case which doesn't appear to be possible at this stage. Any plans to support this...
Read more >
PropTypes import for React is not recognized on class ...
Does anyone have any idea why I can't access .propType on my class? import React from 'react'; import PropTypes from ...
Read more >
Mastering Props And PropTypes In React - Smashing Magazine
This tutorial will introduce you to the details about props, passing and accessing props, and passing information to any component using props.
Read more >
Don't Call PropTypes Warning - React
Don't call PropTypes directly​​ Using PropTypes in any other way than annotating React components with them is no longer supported: var apiShape =...
Read more >
React Pattern: Centralized PropTypes - freeCodeCamp
Avoid repeating yourself by centralizing PropTypes There are three ... I use a named import to get a reference to the exported PropType...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found