Nâng CaoReact Native iconReact Native

Fabric — renderer mới hoạt động ra sao, khác UIManager cũ điểm nào?

UIManager cũ (Paper):
- React reconciler tính diff trên JS thread → gửi message "createView/updateView/removeView" qua bridge → UIManager native execute trong background queue → áp lên main thread.
- Async commit → có thể desync giữa state JS và UIView (vd state nói btn ẩn, UIView vẫn hiện trong vài frame).
- Concurrent React 18 không hoạt động đúng (commit không đồng bộ).

Fabric:
- Reconciler giờ chạy trong C++ (Hermes hoặc node-side), không qua bridge serialize.
- Layout (Yoga) + ShadowTree đặt trong C++, share memory với native renderer.
- Commit phase chạy đồng bộ với React reconciler — khi setState callback chạy, UIView đã updated.
- Hỗ trợ useLayoutEffect đúng nghĩa "trước paint".
- Concurrent React: Suspense, useTransition, automatic batching hoạt động đúng.

Khác biệt thực tế:
- Tap → setState → render: trên Paper có lag visible 16–32ms; trên Fabric đồng bộ trong cùng frame.
- Animation Reanimated UI thread giờ commit đúng order với React commit.
- Custom view native phải register qua Fabric component spec (Codegen) thay vì RCTViewManager.

Migrate cost: native components cũ (vd map view, chart custom) phải refactor sang <ComponentName>Fabric.tsx + .cpp spec. Đa số component thông dụng đã có version Fabric trong RN 0.76+.

Xem toàn bộ React Native cùng filter theo level & chủ đề con.

Mở danh sách React Native