Closed
Description
Is there any way to get react-docgen to traverse imports? See for example React Native Text.js
import type {PressRetentionOffset, TextProps} from './TextProps';
then
const Text = (
props: TextProps,
forwardedRef: ?React.Ref<'RCTText' | 'RCTVirtualText'>,
) => {
return <TouchableText {...props} forwardedRef={forwardedRef} />;
};
const TextToExport = React.forwardRef(Text);
TextToExport.displayName = 'Text';
// TODO: Deprecate this.
/* $FlowFixMe(>=0.89.0 site=react_native_fb) This comment suppresses an error
* found when Flow v0.89 was deployed. To see the error, delete this comment
* and run Flow. */
TextToExport.propTypes = DeprecatedTextPropTypes;
type TextStatics = $ReadOnly<{|
propTypes: typeof DeprecatedTextPropTypes,
|}>;
module.exports = ((TextToExport: any): React.AbstractComponent<
TextProps,
React.ElementRef<HostComponent<TextProps>>,
> &
TextStatics);
generates
"Libraries\\Text\\Text.js": {
"description": "",
"displayName": "Text",
"methods": [],
"composes": [
"../DeprecatedPropTypes/DeprecatedTextPropTypes"
]
},
Meaning, react-docgen doesn't see the definition of TextProps in a separate file. If I replace the import with the definition then everything works as expected.
Metadata
Metadata
Assignees
Labels
No labels