---
id: wiki-2026-0508-fabric
title: Fabric
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [React Native Fabric, Fabric Renderer, RN New Architecture]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [react-native, fabric, renderer, mobile, jsi]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: cpp
  framework: react-native
---

# Fabric

## 매 한 줄
> **"매 Fabric 는 React Native 의 new renderer — JSI 기반 synchronous JS↔native 의 enables"**. 2018-2024 에 incrementally rolled out, RN 0.74+ 에서 default. 매 legacy bridge (async JSON serialization) 의 replace, 매 concurrent React features (Suspense, Transitions) 의 mobile 의 enable.

## 매 핵심

### 매 Architecture (vs Old Bridge)
- **Old bridge**: JS thread ↔ Native thread async JSON messages. Serialize cost, no sync calls, list jank.
- **Fabric**: JSI (JavaScript Interface) — JS engine (Hermes) 의 C++ HostObjects 의 direct access. Sync calls, shared memory, type-safe via codegen.

### 매 Components
- **JSI**: lightweight C++ API for JS engines (Hermes/JSC). 매 binding의 base.
- **Fabric Renderer (C++)**: shadow tree, layout (Yoga), commit phase. 매 cross-platform.
- **TurboModules**: lazy-loaded native modules with codegen-typed interface.
- **Codegen**: TS/Flow types → C++/Java/ObjC native code.
- **Hermes**: default JS engine (faster startup, lower memory, bytecode).

### 매 응용
1. React 18 concurrent features (Suspense, useTransition) on mobile.
2. Synchronous measure/layout queries.
3. Type-safe native module bindings.
4. New Architecture only libs (Reanimated 3, Skia).

## 💻 패턴

### Enable New Architecture (RN 0.76+)
```bash
# Default ON in 0.76+; explicit:
# ios/Podfile
# RCT_NEW_ARCH_ENABLED=1 bundle exec pod install

# android/gradle.properties
newArchEnabled=true
```

### Spec-driven Native Component (Codegen)
```ts
// MyViewNativeComponent.ts
import type { ViewProps } from 'react-native';
import type { Int32, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';

export interface NativeProps extends ViewProps {
  color?: string;
  count?: WithDefault<Int32, 0>;
}

export default codegenNativeComponent<NativeProps>('MyView');
```

### TurboModule Spec
```ts
// NativeCalculator.ts
import type { TurboModule } from 'react-native';
import { TurboModuleRegistry } from 'react-native';

export interface Spec extends TurboModule {
  add(a: number, b: number): number;       // SYNC call (impossible on old bridge)
  greet(name: string): Promise<string>;
}

export default TurboModuleRegistry.getEnforcing<Spec>('Calculator');
```

### iOS TurboModule Implementation
```objc
// Calculator.mm
#import "Calculator.h"

@implementation Calculator
RCT_EXPORT_MODULE()

- (NSNumber *)add:(double)a b:(double)b {
  return @(a + b);
}

- (std::shared_ptr<facebook::react::TurboModule>)
   getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params {
  return std::make_shared<facebook::react::NativeCalculatorSpecJSI>(params);
}
@end
```

### JSI Direct Binding (advanced)
```cpp
// C++ side
runtime.global().setProperty(
  runtime, "nativeAdd",
  Function::createFromHostFunction(runtime,
    PropNameID::forAscii(runtime, "nativeAdd"), 2,
    [](Runtime& rt, const Value&, const Value* args, size_t) {
      return Value(args[0].asNumber() + args[1].asNumber());
    }));
```

### Concurrent Features on RN
```jsx
import { useTransition, Suspense } from 'react';

function App() {
  const [isPending, startTransition] = useTransition();
  const [query, setQuery] = useState('');
  return (
    <>
      <TextInput onChangeText={(t) => startTransition(() => setQuery(t))} />
      <Suspense fallback={<Spinner />}>
        <Results query={query} />
      </Suspense>
    </>
  );
}
```

## 매 결정 기준
| 상황 | Approach |
|---|---|
| New project (2026) | Fabric default (RN 0.76+) |
| Legacy app | Migrate incrementally; interop layer |
| Custom native view | Fabric component + codegen |
| Sync native call | TurboModule (impossible old) |
| Heavy animation | Reanimated 3 (Fabric-only) |

**기본값**: New Architecture ON, Hermes ON, codegen-driven specs.

## 🔗 Graph
- 부모: [[React Native]] · [[React]]
- 변형: [[TurboModules]] · [[Hermes]] · [[JSI]]
- 응용: [[React Native Skia]]
- Adjacent: [[Concurrent React]]

## 🤖 LLM 활용
**언제**: RN new architecture migration, TurboModule/Fabric component authoring, JSI binding.
**언제 X**: pure JS-only RN questions (state management, navigation library).

## ❌ 안티패턴
- **Mixing old bridge modules with Fabric without interop**: runtime crash.
- **Skipping codegen**: hand-written specs drift from native; codegen 의 source of truth.
- **JSI HostObject 의 long-running work**: blocks JS thread; offload to native thread.
- **Old `NativeModules.X` API in new code**: TurboModuleRegistry 의 사용.

## 🧪 검증 / 중복
- Verified (React Native official docs — New Architecture, RFC 0588 Fabric).
- 신뢰도 A.

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — Fabric renderer / new arch full content |
