Convert camera and update doc generation#2057
Conversation
| content = content.replace(/memo\(forwardRef\((.+?)\)\)/, '$1'); | ||
| content = content.replace(/useCallback\(([^,]+), [^)]+\)/g, '$1'); | ||
|
|
There was a problem hiding this comment.
I think those can now be removed with 6.0.0-alpha.3 of react-docgen
package.json
Outdated
| "prettier": "2.6.2", | ||
| "react": "17.0.2", | ||
| "react-docgen": "^5.0.0-beta.1", | ||
| "react-docgen": "rnmapbox/react-docgen#rnmapbox", |
There was a problem hiding this comment.
| "react-docgen": "rnmapbox/react-docgen#rnmapbox", | |
| "react-docgen": "6.0.0-alpha.3", |
I think it now contains the fixes we need See 592
There was a problem hiding this comment.
So if I integrate this, imported types (e.g. AtmosphereLayerStyleProps in Atmosphere.tsx) still don't expand in the documentation, and methods on the ref don't appear in component.methods anymore. Any idea how you want to handle this?
There was a problem hiding this comment.
I just realized this is still open: reactjs/react-docgen#591. Would you want to rebase and we point to your fork? Or I would be happy to set up a patch.
Would really like to just get this merged 😭 🤣
There was a problem hiding this comment.
I've updated the PR and also pushed the merged version to: https://github.com/rnmapbox/react-docgen/tree/basic-hook-support. But last time I was checking it did not generate methods, because our structure is different to what's supported, but worth a try.
|
@naftalibeder test are failing, otherwise it's looks good to go for me |
|
Everything should be good. I tried pointing to the fork of Feel free to merge / let me know if I can! |
|
Thanks much, for the hard work and patience! |
|
Haha thanks for sticking with this to the end! |
Description
This converts the camera to functional component written in Typescript, and updates doc generation to correctly read props in a component like this.
I tried to keep the changes as minimal as possible, although this means that the
Atmospheredocumentation is overwritten with a less useful version. This is because of the larger issue with the generator, where imported types do not get expanded, but local types in the component file do.Checklist
yarn generatein the root folderCHANGELOG.mdindex.d.ts)/example)