Skip to content

Styles should work with ShadowDOM roots. #1517

@xdumaine

Description

@xdumaine

Is your feature request related to a problem? Please describe.

When using styles inside a shadow root, styles are not applied, because react-native-web attaches styles to the document root

Describe a solution you'd like

Automatically attach styles to the shadow root instead of the document root if one is present. Resolve issues of cascading rules where a shadow root breaks up parents from children.

Describe alternatives you've considered

Avoid having styles compiled into a stylesheet with classes altogether, and have all styles inlined on components.

Additional context

The primary context here is that my react app is rendered inside a custom element, which can be included on anyone else's page as a widget. In order to get style isolation, I must render my app inside a shadow root (natively, or using react-shadow). This gives me proper style isolation from the outer (uncontrolled) application, but it also causes me to lose all of my styles from react-native-web.

Metadata

Metadata

Assignees

No one assigned

    Labels

    has: prSubject of a pull request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions