use-dom

Bundle web code in a WebView for native Expo apps.

Updated Sep 7, 2024
One-click install
npx skills add https://github.com/Asylcreek/home-manager --skill use-dom-asylcreek
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: use-dom
Source: https://github.com/Asylcreek/home-manager/tree/main/dots/agents/skills/expo-use-dom
Command: npx skills add https://github.com/Asylcreek/home-manager --skill use-dom-asylcreek

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

DOM components let web code run verbatim in a WebView on native platforms while rendering as-is on web, enabling incremental migration of web apps to native without rewriting logic.

Core Features & Use Cases

  • Reuse web libraries and UI components inside native apps by rendering in a WebView while keeping native performance on the rest of the UI.
  • Incrementally migrate existing web code to native by porting components one by one and gradually replacing web-only dependencies.
  • Configure per-component behavior with the dom prop, enabling control over scrolling, layout, and styling from the native host while preserving web parity.
  • Isolate DOM components in their own context to avoid global state sharing and to simplify CSS scoping and asset management.
  • Use web tooling and libraries (syntax highlighting, charts, HTML layouts) inside native apps without rewriting their logic.

Quick Start

Create a new React component with the 'use dom'; directive at the top and export a default component that uses the dom prop to render web content inside a WebView on native while rendering unmodified on web.

Frequently Asked Questions about use-dom

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run web code in a React Native app?

Run web code in React Native by bundling it inside a WebView using the 'use dom' directive, rendering unmodified on web while executing verbatim on native platforms.

Can I migrate a web app to Expo without rewriting components?

You can migrate a web app to Expo incrementally by porting components one by one, preserving styling and interactivity while rendering web code in a WebView on native.

How does the dom prop control WebView rendering in Expo?

The dom prop configures per-component behavior in the WebView, controlling scrolling, layout, and styling from the native host while maintaining web parity across platforms.

Does use-dom require additional dependencies to render web libraries in native?

No additional dependencies are required to render web libraries in native, as the Skill uses a directive to isolate DOM components in their own context within the existing Expo environment.

What are the limitations of using a WebView for cross-platform migration?

WebView cross-platform migration isolates DOM components in their own context, meaning global state is not shared natively and CSS scoping is contained, requiring exposed native actions for interactivity.

Why use a WebView to render web components instead of porting to native directly?

Use a WebView to reuse existing web tooling and libraries like syntax highlighting or charts inside native apps without rewriting their logic, enabling gradual replacement of web-only dependencies.