Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
7b665cd
feat(extractor): compile Devup UI elements to React Native styles
owjs3901 Nov 19, 2026
c352820
test(extractor): cover the React Native target and wire codeExtractNa…
owjs3901 Nov 19, 2026
5c2691a
fix(extractor): convert style values read at runtime on React Native …
owjs3901 Nov 19, 2026
200d61d
test(extractor): drop the needless raw string hashes and note runtime…
owjs3901 Nov 19, 2026
f0c31ad
feat(metro-plugin): compile Devup UI for React Native in Metro
owjs3901 Nov 19, 2026
694249c
Merge remote-tracking branch 'origin/main' into feat/react-native-metro
owjs3901 Nov 19, 2026
2717c03
ci: drop the react-native-core pull request branch now that it is merged
owjs3901 Nov 19, 2026
6bf5393
feat(native): theme tokens, multiple themes and the React Native runtime
owjs3901 Nov 20, 2026
140a470
ci: load the React Native runtime entry with a react-native stand-in
owjs3901 Nov 20, 2026
065a54c
test(native): cover theme merges and a typography a theme lacks
owjs3901 Nov 20, 2026
b61c854
feat(native): responsive values, responsive tokens and orientation on…
owjs3901 Nov 21, 2026
4daea34
fix(verify-dist): give the react-native stand-in Dimensions
owjs3901 Nov 21, 2026
6c2b6f2
feat(native): press styles through Pressable on React Native
owjs3901 Nov 21, 2026
0fd0de6
wip(native): css() and className on React Native
owjs3901 Nov 21, 2026
33b23f3
wip(native): drop a probe test
owjs3901 Nov 21, 2026
90bd808
fix(native): apply theme, orientation and press blocks after the othe…
owjs3901 Nov 21, 2026
a62bbc4
Merge branch 'feat/react-native-pressed' into feat/react-native-css
owjs3901 Nov 21, 2026
3ba5930
test(native): cover a static style checked against one kept in order
owjs3901 Nov 21, 2026
897e66c
feat(native): css() as CSS text, README and changepack
owjs3901 Nov 21, 2026
ed6ec74
Merge branch 'feat/react-native-pressed' into feat/react-native-css
owjs3901 Nov 21, 2026
4f8a95a
test(native): pass classes to style_code in the merged test
owjs3901 Nov 21, 2026
fb7882a
test(native): cover css() parts around state blocks and empty objects
owjs3901 Nov 21, 2026
7d52b64
test(native): cover a static style checked against a state block
owjs3901 Nov 21, 2026
5078394
Merge branch 'feat/react-native-pressed' into feat/react-native-css
owjs3901 Nov 21, 2026
044555e
feat(native): styled() on React Native
owjs3901 Nov 21, 2026
88a60b4
feat(native): hover, focus and disabled styles on React Native
owjs3901 Nov 21, 2026
7619acd
feat(native): animations and transitions on react-native-reanimated
owjs3901 Nov 21, 2026
7ab44df
feat(native): compile styled-components/native and @emotion/native
owjs3901 Nov 21, 2026
4f9b42a
docs(metro-plugin): fix the duplicated README of the compat section
owjs3901 Nov 21, 2026
d4ba46d
feat(expo): export and check the example on the web
owjs3901 Nov 21, 2026
6fd7158
fix(native): cover the pixel conversion of compat numbers in one stat…
owjs3901 Nov 21, 2026
8f0d057
Merge branch 'feat/react-native-compat' into feat/react-native-web
owjs3901 Nov 21, 2026
487978a
feat(native): type the theme and React Native props of each component
owjs3901 Nov 21, 2026
d70930f
docs(landing): document React Native and its differences from the web
owjs3901 Nov 21, 2026
bba5fc4
feat(native): viewport lengths and reduced motion on React Native
owjs3901 Nov 21, 2026
27976fb
fix(react): let verify-dist load the native runtime that reads Access…
owjs3901 Nov 21, 2026
8f4f040
feat(native): css() and className on React Native (#1046)
owjs3901 Nov 25, 2026
d69078d
feat(native): responsive values, responsive tokens and orientation on…
owjs3901 Nov 25, 2026
adb6e46
Merge origin/main into feat/react-native-themes
owjs3901 Nov 28, 2026
dfba63b
Merge origin/feat/react-native-themes into feat/react-native-pressed
owjs3901 Nov 28, 2026
1803ed6
Merge origin/feat/react-native-pressed into feat/react-native-styled
owjs3901 Nov 28, 2026
93a45bd
Merge origin/main into feat/react-native-pressed
owjs3901 Nov 28, 2026
c3c924d
Merge origin/feat/react-native-styled into feat/react-native-states
owjs3901 Nov 28, 2026
0c97325
Merge origin/main into feat/react-native-pressed
owjs3901 Nov 28, 2026
41b5c85
Merge origin/feat/react-native-pressed into feat/react-native-styled
owjs3901 Nov 28, 2026
9daae42
Merge origin/feat/react-native-styled into feat/react-native-states
owjs3901 Nov 28, 2026
d683fa2
Merge origin/feat/react-native-states into feat/react-native-animations
owjs3901 Nov 28, 2026
5431319
Merge origin/feat/react-native-animations into feat/react-native-compat
owjs3901 Nov 28, 2026
5fb5f3f
Merge origin/feat/react-native-compat into feat/react-native-web
owjs3901 Nov 28, 2026
1621b23
Merge origin/feat/react-native-web into feat/react-native-types
owjs3901 Nov 28, 2026
32520be
Merge origin/feat/react-native-types into feat/react-native-docs
owjs3901 Nov 28, 2026
2b6b3b8
Merge origin/feat/react-native-docs into feat/react-native-viewport
owjs3901 Nov 28, 2026
34caf28
Merge origin/main into feat/react-native-pressed
owjs3901 Nov 28, 2026
44b7337
Merge origin/feat/react-native-pressed into feat/react-native-styled
owjs3901 Nov 28, 2026
0b2a16f
Merge origin/feat/react-native-styled into feat/react-native-states
owjs3901 Nov 28, 2026
e363f8d
Merge origin/feat/react-native-states into feat/react-native-animations
owjs3901 Nov 28, 2026
6b3fd33
Merge origin/feat/react-native-animations into feat/react-native-compat
owjs3901 Nov 28, 2026
7352981
Merge origin/feat/react-native-compat into feat/react-native-web
owjs3901 Nov 28, 2026
ae377fc
Merge origin/feat/react-native-web into feat/react-native-types
owjs3901 Nov 28, 2026
e7582ae
Merge origin/feat/react-native-types into feat/react-native-docs
owjs3901 Nov 28, 2026
4888f33
Merge origin/feat/react-native-docs into feat/react-native-viewport
owjs3901 Nov 28, 2026
15d61a8
feat(native): hover, focus and disabled styles on React Native (#1048)
owjs3901 Nov 28, 2026
ac22019
feat(native): compile styled-components/native and @emotion/native (#…
owjs3901 Nov 28, 2026
015bcfe
feat(native): type the theme and React Native props of each component…
owjs3901 Nov 28, 2026
476e344
docs(landing): document React Native and its differences from the web…
owjs3901 Nov 28, 2026
5b9e58b
Merge origin/main into feat/react-native-styled
owjs3901 Nov 28, 2026
f33ebf0
Merge feat/react-native-animations into feat/react-native-web
owjs3901 Nov 28, 2026
86a4d5b
Merge feat/react-native-styled into feat/react-native-animations
owjs3901 Nov 28, 2026
91d5df8
Merge feat/react-native-web into feat/react-native-viewport
owjs3901 Nov 28, 2026
8fb3988
feat(expo): export and check the example on the web (#1051)
owjs3901 Nov 29, 2026
036997e
docs(landing): translate the React Native docs into Korean (#1064)
owjs3901 Nov 29, 2026
566be9c
feat(landing): add a React Native section to the home page (#1065)
owjs3901 Nov 29, 2026
731946e
Merge origin/main into feat/react-native-animations
owjs3901 Nov 29, 2026
7443515
Merge feat/react-native-animations into feat/react-native-viewport
owjs3901 Nov 29, 2026
a5ebb23
Merge origin/main into feat/react-native-viewport
owjs3901 Nov 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changepacks/changepack_log_metro_viewport_motion.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"changes": {
"packages/metro-plugin/package.json": "Patch"
},
"note": "Compile `vw`/`vh`/`vmin`/`vmax` (and their small, large and dynamic forms) to one multiplication of the window size, and `_motionReduce`/`_motionSafe` to the system's reduced-motion setting, on React Native.",
"date": "2026-11-22T00:00:00.000Z"
}
7 changes: 7 additions & 0 deletions .changepacks/changepack_log_react_native_viewport_motion.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"changes": {
"packages/react/package.json": "Patch"
},
"note": "The React Native runtime adds `useReducedMotion` (from `AccessibilityInfo`), `useWindowWidth`, `useWindowHeight` and the `Sized` wrapper, for `_motionReduce`/`_motionSafe` and viewport lengths. Window changes now notify every hook, and React renders again only the components whose value changed. The runtime grows from 1,185 B to 1,302 B min+gzip.",
"date": "2026-11-22T00:00:00.000Z"
}
23 changes: 19 additions & 4 deletions apps/expo/check-bundle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ import { join } from 'node:path'
const PLACEHOLDER = 'Cannot run on the runtime'
/** Names of the runtime that only code using it holds, as minified code keeps them */
const RUNTIME_NAMES =
/\b(?:defineThemes|useThemeIndex|useBreakpoint|useLandscape|Focused)\b/g
/\b(?:defineThemes|useThemeIndex|useBreakpoint|useLandscape|useReducedMotion|useWindowWidth|useWindowHeight|Focused)\b/g
/** What src/App.tsx must use from the runtime */
const APP_HOOKS = ['useThemeIndex', 'useBreakpoint', 'useLandscape', 'Focused']
const APP_HOOKS = [
'useThemeIndex',
'useBreakpoint',
'useLandscape',
'useReducedMotion',
'useWindowHeight',
'Focused',
]
/** Modules of @devup-ui/react, by the path Metro resolves */
const REACT_PACKAGE = /(^|[\\/])(@devup-ui[\\/]react|packages[\\/]react)[\\/]/
/**
Expand Down Expand Up @@ -99,13 +106,21 @@ function mapSources(map) {
: map.sources
}

/** Each name of the runtime, with the sources of the code that names it */
/**
* Each name of the runtime, with the sources of the app that name it: a
* package may name its own hook the same (Reanimated's `useReducedMotion`)
*/
function runtimeUsers(code, locate) {
const users = new Map()
code.split('\n').forEach((line, index) => {
for (const match of line.matchAll(RUNTIME_NAMES)) {
const source = locate(index, match.index)
if (source === null || NATIVE_RUNTIME.test(source)) continue
if (
source === null ||
NATIVE_RUNTIME.test(source) ||
/[\\/]node_modules[\\/]/.test(source)
)
continue
const sources = users.get(match[0]) ?? new Set()
sources.add(source)
users.set(match[0], sources)
Expand Down
8 changes: 7 additions & 1 deletion apps/expo/check-web.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Opens the web export (`expo export --platform web` wrote dist/) in Chromium
// and checks that react-native-web renders the styles Devup UI compiled: the
// card takes the theme's color and switches with the theme, the input takes
// card takes the theme's color and switches with the theme and is at least
// 30vh tall, the input takes
// its focus style through the runtime's `Focused`, and the button, a
// `Pressable`, counts a press.
import { createReadStream, existsSync, statSync } from 'node:fs'
Expand Down Expand Up @@ -66,6 +67,11 @@ try {
'rgb(255, 255, 255)',
'the card in the light theme',
)
expectEqual(
await style(card, 'minHeight'),
`${(await page.evaluate(() => window.innerHeight)) * 0.3}px`,
'the card, at least 30vh tall',
)
expectEqual(
await style(count, 'backgroundColor'),
'rgb(90, 68, 255)',
Expand Down
8 changes: 7 additions & 1 deletion apps/expo/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@ export function App() {
borderRadius="$radius"
boxShadow="$raised"
maxW={[null, null, '480px']}
minH="30vh"
p={[4, null, 6]}
testID="card"
w="100%"
>
<Text color="$muted" fontSize="14px" mb={2}>
<Text
_motionReduce={{ fontStyle: 'italic' }}
color="$muted"
fontSize="14px"
mb={2}
>
Your name
</Text>
<Input
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/app/(detail)/docs/LeftMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function LeftMenu() {
<MenuItem to="/docs/features">{t('features')}</MenuItem>
<MenuItem to="/docs/limitations">{t('limitations')}</MenuItem>
<MenuItem to="/docs/build-errors">{t('buildErrors')}</MenuItem>
<MenuItem to="/docs/react-native">React Native</MenuItem>
<MenuItem to="/docs/react-native">{t('reactNative')}</MenuItem>
<MenuItem
subMenu={[
{
Expand Down
111 changes: 111 additions & 0 deletions apps/landing/src/app/(detail)/docs/react-native/page.ko.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
export const metadata = {
title: 'React Native',
alternates: {
canonical: '/ko/docs/react-native',
languages: {
en: '/docs/react-native',
ko: '/ko/docs/react-native',
'x-default': '/docs/react-native',
},
},
}

# React Native

> **실험적 기능(0.x).** React Native 지원은 진행 중이며
> ([#411](https://github.com/dev-five-git/devup-ui/issues/411)),
> `@devup-ui/metro-plugin`은 아직 배포되지 않았습니다. API는 바뀔 수 있습니다.

Devup UI는 React Native와 Expo의 번들러인 Metro에서 React Native용으로
컴파일됩니다. `Box`, `Text`, `css`, `styled` 등은 그대로 `@devup-ui/react`에서
import합니다. 빌드 시점에 각 요소는 React Native 컴포넌트가 되고, 스타일 props는
파일마다 하나의 `StyleSheet.create`로 끌어올려진 스타일 객체가 됩니다. 런타임에
CSS를 파싱하는 일은 없습니다.

## 설정

```bash
npm install @devup-ui/react @devup-ui/metro-plugin
```

```js
// metro.config.js (Expo)
const { getDefaultConfig } = require('expo/metro-config')
const { withDevupUI } = require('@devup-ui/metro-plugin')

module.exports = withDevupUI(getDefaultConfig(__dirname))
```

```js
// metro.config.js (React Native CLI)
const { getDefaultConfig } = require('@react-native/metro-config')
const { withDevupUI } = require('@devup-ui/metro-plugin')

module.exports = withDevupUI(getDefaultConfig(__dirname))
```

```tsx
import { Box, Flex, Text } from '@devup-ui/react'

export function Card() {
return (
<Flex bg="$card" borderRadius="12px" gap={2} p={[4, null, 6]}>
<Text color="$text" typography="title">
Hello
</Text>
<Box bg="red" h="8px" w="8px" />
</Flex>
)
}
```

Metro는 설정을 읽을 때 `df/theme.d.ts`와 `df/native.d.ts`를 생성합니다. 이 파일들
덕분에 에디터에서 테마 토큰이 자동 완성되고, 각 컴포넌트는 자신이 렌더링하는
React Native 컴포넌트의 props(`onPress`, `onChangeText`, `testID` 등)를 받습니다.

## 요소

| 요소 | React Native |
| --------------------------------- | ------------------------------- |
| `Box`, `Flex`, `VStack`, `Center` | `View` |
| `Text` | `Text` |
| `Image` | `Image` (`src`는 `source`가 됨) |
| `Input` | `TextInput` |
| `Button` | `Pressable` |

## 웹과의 차이

같은 컴포넌트 코드가 양쪽 모두로 빌드되지만, React Native에는 CSS가 없기 때문에
일부는 다르게 동작합니다.

| | 웹 | React Native |
| ------------------------------------------ | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 출력 | 스타일시트의 아토믹 CSS 클래스 | 파일마다 하나의 `StyleSheet.create` 안의 스타일 객체 |
| 런타임 | 없음 | 정적 스타일에는 없습니다. 작은 런타임(gzip 약 1.3 kB)이 테마, 창, 동작 줄이기 설정, 입력 요소의 포커스를 읽지만, 이를 사용하는 스타일에만 쓰입니다. `runtime: false`로 설정하면 그런 스타일은 대신 빌드 오류가 됩니다. |
| 숫자 | `p={4}`는 `16px` | `p={4}`는 `16`: 밀도 독립 픽셀이며, 웹과 같은 배율을 사용합니다 |
| 단위 | 모든 CSS 단위 | 픽셀, `rem`과 `em`(각각 16픽셀), 백분율, `auto`. `vw`, `vh`, `vmin`, `vmax`는 창 크기에 대한 곱셈 한 번이 되며, 창 크기가 바뀌면 이를 사용하는 컴포넌트만 다시 렌더링됩니다. |
| 테마 | `data-theme`으로 전환되는 CSS 변수 | 런타임이 현재 테마의 스타일 객체를 고릅니다. `setTheme`, `useTheme`, `getTheme`가 동작하며, 시스템 화면 모드에 따라 `light` 또는 `dark`가 선택됩니다. |
| 브레이크포인트 | 미디어 쿼리 | devup.json의 `breakpoints`를 기준으로 한 창 너비. 창이 다른 브레이크포인트로 넘어갈 때만 컴포넌트가 다시 렌더링됩니다. |
| `_active`, `_hover`, `_focus`, `_disabled` | CSS 가상 클래스 | `Pressable`이 스타일 함수에 눌림, 호버, 포커스 여부를 알려 줍니다. `Button`은 `Pressable`이며, 이런 스타일을 가진 `Box`는 `Pressable`이 됩니다. `Input`의 `_focus`는 런타임을 통해 동작합니다. `_disabled`는 `disabled` prop을 읽습니다. 호버와 포커스는 웹처럼 포인터나 키보드 포커스가 있는 곳에서만 일어납니다. |
| 그 밖의 선택자 | `_before`, `_focusVisible`, `selectors` 등 | 빌드 오류: React Native에는 선택자가 없습니다 |
| `_ios`, `_android`, `_web` | — | 해당 플랫폼에서만 적용 |
| `_portrait`, `_landscape` | 미디어 쿼리 | 창의 방향 |
| `_motionReduce`, `_motionSafe` | `prefers-reduced-motion` 미디어 쿼리 | 시스템이 앱에 동작 줄이기를 요청하는지 여부(`AccessibilityInfo`) |
| `className={css(...)}` | 클래스 | 빌드가 이를 요소의 스타일로 바꿉니다 |
| `keyframes`, `animation*`, `transition*` | CSS 애니메이션 | [react-native-reanimated](https://docs.swmansion.com/react-native-reanimated/): 애니메이션되는 요소는 Reanimated의 animated 컴포넌트를 렌더링합니다. Reanimated가 설치되어 있지 않으면 빌드 오류가 됩니다. |
| `globalCss`, `Grid` | 지원 | 빌드 오류 |
| styled-components와 Emotion | `styled-components`, `@emotion/styled` 등 | `styled-components/native`와 `@emotion/native`도 같은 방식으로 컴파일됩니다. 숫자는 해당 패키지가 해석하는 대로 픽셀입니다. |
| 지원하지 않는 속성 | — | React Native에 해당 스타일이 없는 속성(`gridTemplateColumns`, `float` 등)은 빌드 오류입니다 |

빌드 오류는 웹과 마찬가지로 스타일이 있는 파일, 줄, 열을 가리킵니다.

## Expo 웹

웹에서 Expo는 [react-native-web](https://necolas.github.io/react-native-web/)을
통해 Metro로 앱을 번들링하며, 같은 네이티브 출력이 그곳에서 CSS로 바뀝니다. Expo
앱이 아닌 사이트는 계속 [Vite, Next.js, Webpack, Rsbuild 또는 Bun 플러그인](/docs/installation)을
사용하며, 이 플러그인들은 대신 아토믹 CSS를 출력합니다.

각 옵션과 기능의 자세한 내용은
[`@devup-ui/metro-plugin` README](https://github.com/dev-five-git/devup-ui/tree/main/packages/metro-plugin)를
참고하세요.
Loading
Loading