airbnb/react-sketchapp

Question: Does react-sketchapp work with plain react code at all ?

imvetri opened this issue ยท 6 comments

๐Ÿ‘‹ Hello! I am Vetrivel. I am reporting a behaviour and I am not sure whether its a feature request or a bug.

Proposal/Feature-request: Sketchapp to work for any react jsx.

Expected behavior: Sketch to render the jsx

Observed behavior: Sketch throws error "Could not find a renderer for type "p"

How to reproduce: Type

Hello

in any examples and see in sketch

Sketch version: v 65

Please attach screenshots, a zip file of your project, and/or a link to your github project - Attached screenshot
Screenshot 2020-06-10 at 4 19 07 PM

"plain" react doesn't have any component, you are talking about "react-dom" which no, doesn't work in Sketch

@mathieudutour Can I request a feature for react-dom support?

What would p translate to? What would input translate to? Those aren't components that make sense in Sketch. The same way react-native doesn't support react-dom, react-sketchapp doesn't support react-dom.

While it could be possible to find a translation for all the dom components, it's really out of scope of this project.

  • p translates to a View with Text inside.
  • input translates to a View with border and Text inside.

Visually any HTML element translates to just View and Text. Lets say there is a div with a text in a component, and its translated version would be View and Text. The same applies to any HTML element when we see it as a View and Text.

Same applies to every other HTML elements as everything is just a rectangular box with text or image in it.

The translation logic boils down to below.

  • By default everything is a View
  • If dome component contains a text or string, it becomes a Text.

The same way react-native doesn't support react-dom, react-sketchapp doesn't support react-dom.

While it could be possible to find a translation for all the dom components, it's really out of scope of this project.

For more information, see #29 (comment)