1. ํ์ ์ฌ์ ์๊ฑด & ์์คํ ์๊ตฌ์ฌ์ (Prerequisites & System Requirements)
๐ป ์์คํ ์ค์น ๋ฐ ์คํ ์๊ตฌ์ฌ์ (System Requirements)
| ํญ๋ชฉ | Windows ๊ฐ๋ฐ ํ๊ฒฝ (react-native-windows) | macOS ๊ฐ๋ฐ ํ๊ฒฝ (react-native-macos) | ๊ณตํต ์ฐธ๊ณ ๋ฐ ๋น๊ณ |
|---|---|---|---|
| ์ด์์ฒด์ (OS) | Windows 10 (21H2+) ๋๋ Windows 11 (22H2/23H2+) | macOS 14.x (Sonoma) ๋๋ macOS 15.x (Sequoia) | ๊ฐ OS๋ณ ๋ค์ดํฐ๋ธ ์ปดํ์ผ ํด์ฒด์ธ ํ์ |
| ๋ค์ดํฐ๋ธ IDE | Visual Studio 2022 (v17.8+) ๋๋ VS 2026 | Xcode 15.x / 16.x ๋ฐ Command Line Tools | C++ ๋ฐ์คํฌํฑ ๊ฐ๋ฐ ์ํฌ๋ก๋ ํ์ |
| SDK ๋ฐ ํ๋ ์์ํฌ | Windows 10/11 SDK (10.0.19041+) & Windows App SDK | macOS Deployment Target 11.0+ / 14.0+ | WinUI 3 (Windows) / AppKit (macOS) |
| Node.js ๋ฐํ์ | Node.js v20.x ๋๋ v22.x LTS (x64 / ARM64) | Node.js v20.x ๋๋ v22.x LTS (Apple Silicon) | ํจํค์ง ๋งค๋์ yarn v1.22+ ๋๋ npm v10+ |
| CPU | 4 ์ฝ์ด ์ด์ (x86_64 ๋๋ Windows on ARM) | Apple Silicon (M1/M2/M3/M4) ๊ถ์ฅ | ๋ค์ดํฐ๋ธ C++ XAML / Objective-C++ ์ปดํ์ผ |
| ๋ฉ๋ชจ๋ฆฌ (RAM) | ์ต์ 16 GB ์ด์ ๊ถ์ฅ (์ต์ 8 GB) | ์ต์ 16 GB ์ด์ ๊ถ์ฅ (์ต์ 8 GB) | Visual Studio MSBuild ๋ฐ Xcode ๋น๋ ๊ฐ์ |
| ๋์คํฌ (Storage) | 30 GB ์ด์์ ์ฌ์ ๊ณต๊ฐ (๊ณ ์ SSD ํ์) | 25 GB ์ด์์ ์ฌ์ ๊ณต๊ฐ (๊ณ ์ SSD ํ์) | C++ ํค๋, ๋น๋ ์บ์, ํ์ ๋ฐ์ดํฐ(DerivedData) |
[!IMPORTANT] ๊ณต์ ๋ฒค๋ ์ต์ ๋ฒ์ ์ ๋ณด (Microsoft Windows App SDK & Meta New Architecture):
- React Native Core ๋ฒ์ : v0.85+
- react-native-windows: v0.85.x+ (Microsoft ์คํ์์ค ์ฃผ๋)
- react-native-macos: v0.85.x+ (Meta & ์ปค๋ฎค๋ํฐ ์ฃผ๋)
- ๋ด ์ํคํ ์ฒ(New Architecture) ์์ ํ์ํ:
๊ณผ๊ฑฐ ๊ตฌ๋ฒ์ ์ ๋น๋๊ธฐ ์ง๋ ฌํ ๋ธ๋ฆฟ์ง(Legacy Bridge / Paper)๋ **์์ ํ ์ ๊ฑฐ(Deprecated & Stripped)**๋์์ต๋๋ค.
ํ์ฌ React Native Desktop์ C++ JSI(JavaScript Interface)๋ฅผ ํตํ ์ด๊ณ ์ ๋๊ธฐ์ ๋ฉ๋ชจ๋ฆฌ ์ง์ ํต์ , Fabric ๋ค์ดํฐ๋ธ ๋ ๋๋ฌ, ๊ทธ๋ฆฌ๊ณ ํ์ ์์ ํ TurboModules๋ง์ ์ ๋ฉด ์ง์ํ์ฌ, Electron ๋๋น 60% ์ด์์ ๋ฉ๋ชจ๋ฆฌ ์ ๊ฐ๊ณผ 60FPS ์ด์์ ๋ค์ดํฐ๋ธ ์๋์ฐ ๋ ๋๋ง ์ฑ๋ฅ์ ๋ณด์ฅํฉ๋๋ค.
๐ ๏ธ 1. ๊ฐ๋ฐ ํ๊ฒฝ ์ด๊ธฐํ ๋ฐ ํ๋ก์ ํธ ์์ฑ
Windows์ macOS ๊ฐ ํ๋ซํผ์ ๋ง์ถ์ด ํ๋ก์ ํธ๋ฅผ ์ค์บํด๋ฉํฉ๋๋ค.
๐ช Windows ํ๊ฒฝ ์ค์ (PowerShell ๊ด๋ฆฌ์ ๊ถํ)
# 1. Microsoft ๊ถ์ฅ ์๋ ํ๊ฒฝ ์ค์ ์คํฌ๋ฆฝํธ ์คํ (Visual Studio, SDK ์๋ ์ ๊ฒ)
Set-ExecutionPolicy Unrestricted -Scope Process -Force
iex (New-Object System.Net.WebClient).DownloadString('https://aka.ms/rnw-vs-setup.ps1')
# 2. React Native v0.85+ ํ๋ก์ ํธ ์์ฑ ๋ฐ Windows ํ๋ฌ๊ทธ์ธ ์ถ๊ฐ
npx @react-native-community/cli@latest init MyDesktopApp --version 0.85.0
cd MyDesktopApp
npx react-native-windows-init --overwrite
# 3. Windows ๋ค์ดํฐ๋ธ ์ฑ ์ปดํ์ผ ๋ฐ ์คํ
npx react-native run-windows
๐ macOS ํ๊ฒฝ ์ค์ (Terminal)
# 1. React Native ํ๋ก์ ํธ ์์ฑ ๋ฐ macOS ํ๋ฌ๊ทธ์ธ ์ถ๊ฐ
npx @react-native-community/cli@latest init MyDesktopApp --version 0.85.0
cd MyDesktopApp
npx react-native-macos-init
# 2. CocoaPods ๋ค์ดํฐ๋ธ ์์กด์ฑ ์ค์น
cd macos && pod install && cd ..
# 3. macOS ๋ค์ดํฐ๋ธ ์ฑ ์ปดํ์ผ ๋ฐ ์คํ
npx react-native run-macos
2. ์ง๊ด์ ์ธ ๋ฉํ ๋ชจ๋ธ (ASCII Diagram)
React Native for Desktop์ New Architecture ๋ ๋๋ง ํ์ดํ๋ผ์ธ์ ๋๋ค.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ React Native for Desktop ๋ด ์ํคํ
์ฒ ํ์ดํ๋ผ์ธ โ
โ โ
โ [JavaScript / TypeScript ์ฝ๋] โ
โ (React ์ปดํฌ๋ํธ, State, Hook, UI ๋ ๋๋ง ์ ์) โ
โ โ โ
โ โผ (Hermes ๊ณ ์ฑ๋ฅ JS ๋ฐ์ดํธ์ฝ๋ ์คํ) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ JSI (JavaScript Interface) โ โ
โ โ โข ์ง๋ ฌํ/JSON ์ธ์ฝ๋ฉ ์๋ C++ ๋ค์ดํฐ๋ธ ํฌ์ธํฐ ๋ฉ๋ชจ๋ฆฌ ์ง์ ์ ๊ทผโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโ โ
โ โผ โผ โ
โ [Fabric UI ๋ ๋๋ฌ] [TurboModules ์์ง] โ
โ โข C++ ํฌ๋ก์คํ๋ซํผ ์ฝ์ด โข OS ๋ค์ดํฐ๋ธ ๊ธฐ๋ฅ ์ง์ ํธ์ถ โ
โ โข Yoga ๋ ์ด์์ ์์ง ๊ณ์ฐ โข ํ์ผ I/O, ์์คํ
ํธ๋ ์ด, ๋ ์ง์คํธ๋ฆฌโ
โ โ โ โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Windows (WinUI 3 / XAML) โ macOS (AppKit / Cocoa) โ โ
โ โ โข DirectX ํ๋์จ์ด ๊ฐ์ โ โข Metal ํ๋์จ์ด ๊ฐ์ โ โ
โ โ โข Windows Fluent Design โ โข macOS ๋ฉ๋ด๋ฐ & ์๋์ฐ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
3. ๋จ๊ณ๋ณ ์ค์ต (Step-by-Step Walkthrough)
[์ด๋ณด์ 1๋จ๊ณ] ํฌ๋ก์๋: ํฌ๋ก์คํ๋ซํผ ๋ฐ์คํฌํฑ ๋ฉ์ธ ํ๋ฉด
Windows์ macOS์์ ๋ค์ดํฐ๋ธ ์๋์ฐ ์คํ์ผ๋ก ์คํ๋๋ ์ต์ ๋์ ์ฝ๋์ ๋๋ค.
๐ App.tsx
import React, { useState } from "react";
import {
SafeAreaView,
StyleSheet,
Text,
View,
TouchableOpacity,
Platform,
} from "react-native";
export default function App() {
const [count, setCount] = useState<number>(0);
const platformName =
Platform.OS === "windows"
? "Windows (WinUI 3)"
: Platform.OS === "macos"
? "macOS (AppKit)"
: "Mobile";
return (
<SafeAreaView style={styles.container}>
<View style={styles.card}>
<Text style={styles.title}>๐ React Native for Desktop</Text>
<Text style={styles.subtitle}>
ํ์ฌ ์คํ ํ๊ฒฝ: <Text style={styles.highlight}>{platformName}</Text>
</Text>
<Text style={styles.counterText}>ํด๋ฆญ ํ์: {count}</Text>
<View style={styles.buttonGroup}>
<TouchableOpacity
style={[styles.button, styles.primaryButton]}
onPress={() => setCount((c) => c + 1)}
>
<Text style={styles.buttonText}>+1 ์ฆ๊ฐ</Text>
</TouchableOpacity>
<TouchableOpacity
style={[styles.button, styles.secondaryButton]}
onPress={() => setCount(0)}
>
<Text style={styles.secondaryButtonText}>์ด๊ธฐํ</Text>
</TouchableOpacity>
</View>
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: Platform.select({
windows: "#f3f3f3",
macos: "#ececec",
default: "#ffffff",
}),
},
card: {
width: 480,
padding: 32,
borderRadius: 12,
backgroundColor: "#ffffff",
shadowColor: "#000",
shadowOpacity: 0.1,
shadowRadius: 10,
elevation: 4,
},
title: {
fontSize: 24,
fontWeight: "bold",
color: "#111827",
marginBottom: 8,
},
subtitle: {
fontSize: 14,
color: "#4b5563",
marginBottom: 20,
},
highlight: {
fontWeight: "700",
color: "#10b981",
},
counterText: {
fontSize: 18,
fontWeight: "600",
color: "#374151",
marginBottom: 24,
},
buttonGroup: {
flexDirection: "row",
gap: 12,
},
button: {
paddingVertical: 10,
paddingHorizontal: 20,
borderRadius: 6,
alignItems: "center",
},
primaryButton: {
backgroundColor: "#10b981",
},
secondaryButton: {
backgroundColor: "transparent",
borderWidth: 1,
borderColor: "#d1d5db",
},
buttonText: {
color: "#ffffff",
fontWeight: "600",
},
secondaryButtonText: {
color: "#374151",
fontWeight: "600",
},
});
[2๋จ๊ณ] ํต์ฌ ๊ธฐ๋ฅ: ๋ฐ์คํฌํฑ ์ ์ฉ ํค๋ณด๋ ๋จ์ถํค & ๋ง์ฐ์ค ์ด๋ฒคํธ ์ฒ๋ฆฌ
๋ชจ๋ฐ์ผ์๋ ์๋ ๋ฐ์คํฌํฑ ๊ณ ์ ์ ๋ง์ฐ์ค ์ค๋ฒ(Hover), ํค๋ณด๋ ํฌ์ปค์ค ๋ฐ ๋จ์ถํค ํธ๋ค๋ฌ ๊ตฌํ์ ๋๋ค.
๐ src/components/DesktopActions.tsx
import React, { useState } from "react";
import { View, Text, StyleSheet, Platform } from "react-native";
export default function DesktopActions() {
const [isHovered, setIsHovered] = useState<boolean>(false);
const [lastKeyPressed, setLastKeyPressed] = useState<string>("์์");
// ๋ฐ์คํฌํฑ ํค๋ณด๋ ์ด๋ฒคํธ ํธ๋ค๋ฌ
const handleKeyDown = (e: any) => {
const key = e.nativeEvent.key;
const ctrlOrCmd = e.nativeEvent.ctrlKey || e.nativeEvent.metaKey;
if (ctrlOrCmd && key.toLowerCase() === "s") {
setLastKeyPressed("์ ์ฅ ๋จ์ถํค ๊ฐ์ง (Ctrl+S / Cmd+S)");
console.log("[Desktop Action] ๋ฌธ์ ์๋ ์ ์ฅ ํธ๋ฆฌ๊ฑฐ");
} else {
setLastKeyPressed(`์
๋ ฅ๋ ํค: ${key}`);
}
};
return (
<View
style={[styles.box, isHovered && styles.boxHovered]}
focusable={true}
onKeyDown={handleKeyDown}
// react-native-windows / macos ๋ง์ฐ์ค ์ค๋ฒ ํ์ฅ ์ด๋ฒคํธ
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
>
<Text style={styles.boxTitle}>๐ฅ๏ธ ๋ฐ์คํฌํฑ ํค๋ณด๋ & ๋ง์ฐ์ค ์์ญ</Text>
<p style={{ margin: 0 }}>์ด ์์ญ์ ํด๋ฆญํ์ฌ ํฌ์ปค์คํ ํ ํค๋ณด๋๋ฅผ ๋๋ฌ๋ณด์ธ์.</p>
<Text style={styles.statusText}>
๋ง์ฐ์ค ์ค๋ฒ ์ํ: <strong>{isHovered ? "๋ง์ฐ์ค ์ง์
(Hover)" : "์์ญ ๋ฐ"}</strong>
</Text>
<Text style={styles.statusText}>
๋ง์ง๋ง ๋จ์ถํค ์ํ: <span style={{ color: "#10b981" }}>{lastKeyPressed}</span>
</Text>
</View>
);
}
const styles = StyleSheet.create({
box: {
padding: 24,
borderRadius: 8,
borderWidth: 2,
borderColor: "#e5e7eb",
backgroundColor: "#ffffff",
marginTop: 16,
},
boxHovered: {
borderColor: "#10b981",
backgroundColor: "#f0fdf4",
},
boxTitle: {
fontSize: 16,
fontWeight: "bold",
marginBottom: 8,
color: "#1f2937",
},
statusText: {
marginTop: 8,
fontSize: 13,
color: "#4b5563",
},
});
[3๋จ๊ณ] ์ค๋ฌด ์์ฉ: TypeScript ๊ธฐ๋ฐ TurboModule ๋ค์ดํฐ๋ธ ๋ฐ์ธ๋ฉ
TypeScript๋ก ์คํ์ ์ ์ธํ๊ณ C++ / Swift ๋ค์ดํฐ๋ธ ์ฝ๋๋ฅผ ์ง์ ํธ์ถํ๋ ์ฐจ์ธ๋ TurboModule ์ํคํ ์ฒ์ ๋๋ค.
๐ src/specs/NativeSystemInfo.ts (Codegen ์คํ ํ์ผ)
import type { TurboModule } from "react-native";
import { TurboModuleRegistry } from "react-native";
export interface Spec extends TurboModule {
// OS ์์คํ
ํธ์คํธ๋ช
๋ฐ CPU ์ํคํ
์ฒ ์กฐํ
getSystemArchitecture(): string;
// ๋ค์ดํฐ๋ธ ํ์ผ ์ ์ฅ ๋ํ์์ ์คํ (๋น๋๊ธฐ)
openNativeSaveDialog(defaultName: string): Promise<string | null>;
}
export default TurboModuleRegistry.getEnforcing<Spec>("NativeSystemInfo");
๐ ์ปดํฌ๋ํธ์์ ๋ค์ดํฐ๋ธ ๋ชจ๋ ํธ์ถ
import React, { useState } from "react";
import { View, Text, Button } from "react-native";
import NativeSystemInfo from "./specs/NativeSystemInfo";
export default function NativeBridgeView() {
const [arch, setArch] = useState<string>("");
const handleFetchArch = () => {
// JSI๋ฅผ ํตํ ์ ๋ก ์ค๋ฒํค๋ ๋๊ธฐ์ ์ง์ ํธ์ถ
const result = NativeSystemInfo.getSystemArchitecture();
setArch(result);
};
return (
<View style={{ padding: 20 }}>
<Button title="OS ๋ค์ดํฐ๋ธ ์ํคํ
์ฒ ์กฐํ" onPress={handleFetchArch} />
{arch ? <Text style={{ marginTop: 10 }}>๊ฒฐ๊ณผ: {arch}</Text> : null}
</View>
);
}
4. ์ค๋ฌด ์ฃผ์์ฌํญ & ํ๋ก๋์ ์ฒดํฌ๋ฆฌ์คํธ
โ ๏ธ ๊ฐ๋ฐ ์ ์ฃผ์ํด์ผ ํ ํต์ฌ ์ฌํญ (Desktop Gotchas)
- ํฌ์ปค์ค(Focus) ๊ด๋ฆฌ์ ํค๋ณด๋ ์ ๊ทผ์ฑ ํ์:
- ๋ชจ๋ฐ์ผ๊ณผ ๋ฌ๋ฆฌ ๋ฐ์คํฌํฑ ์ฌ์ฉ์๋ ๋ง์ฐ์ค์ Tab ํค๋ฅผ ํตํ ๋ด๋น๊ฒ์ด์
์ ๊ธฐ๋ณธ์ผ๋ก ๊ธฐ๋ํฉ๋๋ค. ๋ชจ๋ ํด๋ฆญ ๊ฐ๋ฅํ ์์์
focusable={true}๋ฐ ๋ช ํํ ์๊ฐ์ ํฌ์ปค์ค ์คํ์ผ(Focus Ring)์ ๋ถ์ฌํด์ผ ํฉ๋๋ค.
- ๋ชจ๋ฐ์ผ๊ณผ ๋ฌ๋ฆฌ ๋ฐ์คํฌํฑ ์ฌ์ฉ์๋ ๋ง์ฐ์ค์ Tab ํค๋ฅผ ํตํ ๋ด๋น๊ฒ์ด์
์ ๊ธฐ๋ณธ์ผ๋ก ๊ธฐ๋ํฉ๋๋ค. ๋ชจ๋ ํด๋ฆญ ๊ฐ๋ฅํ ์์์
- ์๋์ฐ ์ฐฝ ํฌ๊ธฐ ๋ณ๊ฒฝ(Resize) ๋ ์ด์์ ๋์:
- ๊ณ ์ ๋ ํ๋ฉด ํฌ๊ธฐ๋ฅผ ๊ฐ์ ํ์ง ๋ง์ธ์.
useWindowDimensions()ํ ์ ์ฌ์ฉํ์ฌ ์ต์ ๋๋น(Min Width)์ ๋ฐ์ํ ๋ถ๊ธฐ์ (Grid Layout)์ ํ์์ ์ผ๋ก ์ฒ๋ฆฌํด์ผ ํฉ๋๋ค.
- ๊ณ ์ ๋ ํ๋ฉด ํฌ๊ธฐ๋ฅผ ๊ฐ์ ํ์ง ๋ง์ธ์.
- Visual Studio C++ ์ํฌ๋ก๋ ๋๋ฝ ์ฃผ์ (Windows):
- ๋น๋ ์คํจ์ 90%๋
MSVC v143+ C++ x64/x86 ๋น๋ ๋๊ตฌ๋๋Windows App SDK C++ ํ ํ๋ฆฟ๋ฏธ์ค์น๋ก ์ธํด ๋ฐ์ํฉ๋๋ค. Visual Studio Installer์์ **โC++๋ฅผ ์ฌ์ฉํ ๋ฐ์คํฌํฑ ๊ฐ๋ฐโ**์ ๋ฐ๋์ ์ฒดํฌํ์ธ์.
- ๋น๋ ์คํจ์ 90%๋
๐ ํ๋ก๋์ ๋น๋ & ์คํ ์ด ํจํค์ง ๋ช ๋ น์ด
# [Windows] Microsoft Store ์ ์ถ์ฉ MSIX ํจํค์ง ๋ฆด๋ฆฌ์ค ๋น๋
npx react-native run-windows --release --arch x64
# [macOS] Mac App Store / Notarization(๊ณต์ฆ) ๋ฐฐํฌ์ฉ ์์นด์ด๋ธ ์์ฑ
cd macos
xcodebuild -workspace MyDesktopApp.xcworkspace -scheme MyDesktopApp -configuration Release archive -archivePath build/MyDesktopApp.xcarchive
์๊ฒฌ ๋ฐ ์ง๋ฌธ
0์์ง ๋ฑ๋ก๋ ์๊ฒฌ์ด ์์ต๋๋ค. ์ฒซ ๋ฒ์งธ ๋๊ธ์ ๋จ๊ฒจ๋ณด์ธ์!
๋๊ธ ์์
๋๊ธ ์ญ์