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

refactor: abstract outline rendering #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jwajgelt
Copy link

Moves canvas-related code out of new-outlines/index.ts and abstracts the canvas operations with an OutlineRenderer interface.

jwajgelt added a commit to software-mansion/radon-ide that referenced this pull request Feb 26, 2025
Adds the "Outline Renders" tool which highlights React components when
they are rendered. Based on
[react-scan](https://github.com/aidenybai/react-scan) utility.

- we reuse the [`react-scan`](https://github.com/aidenybai/react-scan)
implementation of drawing the outlines on the canvas. Accessing it from
our frontend code required abstracting the renderer code and exporting
it from the package. These changes are available and pulled from a
public fork the `react-scan` repository.
software-mansion-labs/react-scan#1
- we use the [`bippy`](https://github.com/aidenybai/bippy) library for
instrumenting the React rendering process. We include the built library
code (extracted from the official release) in this repo in the
`packages/vscode-extension/lib/bippy` directory and inject it into the
RN Application bundle.
We do it this way because it needs to be included in the final extension
package in order to be injected into the RN application, and only the
`lib` directory is available to Metro.

### How Has This Been Tested: 
- Open the "Tools" dropdown and toggle "Outline Renders".
- Trigger component updates in the application.
- The updated components should be briefly highlighted, with their names
and update counter displayed.
- Resizing the phone Preview should not break the outlines' positions.
- The tool's enabled status should persist app, extension and IDE
launches/reloads.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant