Open rpominov opened 9 years ago
+1
I feel like I would personally only use react-demo
if it did this automatically. Otherwise there's too much overhead in maintaining type for me.
I looked into the React PropTypes and it encapsulates the intended type. I think the only way to get it working would be to iterate the target components proptypes checking against all types to determine which one they used.
I'm willing to help out with this!
Thoughts?
Yeah, I guess iterate over all React.PropTypes
is the only option for us. But a bigger problem is that we won't be able to detect types like React.PropTypes.oneOf(...)
because it's just a function created dynamically every time. So this automatic detection will probably work only in simple cases.
Any news about that point?
See if we could analyze
Target.propTypes
so instead of<Demo target={Target} props={...} />
, we could do just<Demo target={Target} />
and appropriate controls for props would be chosen automatically.