TL;DR: 무한 스크롤 성능 개선을 위해 Text 컴포넌트 대신 NativeText를 직접 사용하기.
// 기존 ❌
import { Text } from "react-native";
// 개선 ✅
import { NativeText } from "react-native/Libraries/Text/TextNativeComponent";
<Text style={{ fontSize: 20 }}>
부모 텍스트
<Text style={{ color: "red" }}>자식 텍스트</Text>
</Text>
TextAncestor 동작 메커니즘 🔄
// ... existing code ...
<TextAncestor.Provider value={true}>
{children}
</TextAncestor.Provider>
스타일 상속: 자식 Text는 부모의 fontSize(20)을 상속 + color(red)로 오버라이드
성능 주의: Context 업데이트로 인해 10중 이상 중첩시 렌더링 시간 2~3배 증가 ⚠️
| 케이스 | 솔루션 | 예시 |
|---|---|---|
| 스타일 상속 필요 | Text 중첩 | <Text><Text>...</Text></Text> |
| 고성능 요구 | NativeText 분리 | <View><NativeText/><NativeText/></View> |
