react-native-nitro-text
iOS 및 Android 모두에서 훨씬 풍부하고 성능이 뛰어난 텍스트 컴포넌트입니다.
기능
- iOS와 Android 모두에서 작동(현재 Android에서는 RN
Text로 대체) - 부드러운 선택이 가능한 네이티브 iOS 렌더링.
- 중첩된 조각들이 단일 네이티브 텍스트 뷰로 병합됨
- 마크다운 및 HTML 렌더링(곧 지원 예정).
- 새로운 아키텍처만 지원
요구사항
- React Native v0.78.0 이상 (Fabric/Nitro Views)
- Node 18+ (Node 20+ 권장)
설치
yarn add react-native-nitro-text react-native-nitro-modulesiOS
cd ios && pod install && cd ..이게 전부입니다. 이제 앱에서 NitroText 컴포넌트를 사용할 수 있습니다.
사용법
import { NitroText as Text } from 'react-native-nitro-text'export function Title() {
return (
🚀 NitroText Showcase
)
}
선택
iOS는 네이티브 선택을 사용합니다. Android에서 NitroText는 현재 React Native Text로 대체됩니다.
import { NitroText as Text } from 'react-native-nitro-text'export function SelectionExample() {
return (
Long-press to select this text. NitroText supports smooth selection,
even with inline styles and
longer paragraphs.
)
}
HTML 렌더링
NitroText는 renderer="html"을 전달할 때 HTML 문자열 자식과 인라인 CSS를 구문 분석할 수 있습니다.
import { NitroText } from 'react-native-nitro-text'export function HtmlExample() {
const html =
Renderer demo
This text comes from HTML with semantic tags.
Inline CSS works too.
return {html}
}
사용자 정의 선택 메뉴
NitroText는 텍스트가 선택될 때 나타나는 사용자 정의 메뉴 항목을 지원합니다. title과 action 콜백을 포함하는 메뉴 항목 배열과 함께 menus 속성을 전달하세요.
import { NitroText } from 'react-native-nitro-text'
import { useMemo } from 'react'export function MenuExample() {
const menus = useMemo(
() => [
{
title: 'Copy',
action: () => console.log('Copy action')
},
{
title: 'Share',
action: () => console.log('Share action')
},
{
title: 'Translate',
action: () => console.log('Translate action')
},
],
[]
)
return (
Select this text to see custom menu options appear in the selection menu.
)
}
플랫폼 지원
- iOS
- Android - 현재
NitroText는 RNText로 대체됩니다.
왜 NitroText인가?
최소한의 JS 오버헤드와 네이티브 iOS 선택 기능을 갖춘 맞춤 네이티브 텍스트 뷰입니다. 스타일이 복잡하거나 중첩된 텍스트 및 대용량 목록에 적합합니다. RN Text 컴포넌트의 드롭인 교체품입니다.
개발
bun run build— 타입 검사 및 패키지 빌드bun run codegen— 코드 생성 출력 재생성example/에 예제 앱 있음
크레딧
create-nitro-module로 부트스트랩됨.
기여
PR 환영합니다! 주요 변경 사항은 먼저 이슈를 열어주세요.
💬 빠른 지원을 위해 Discord 채널에 참여하세요.
--- Tranlated By Open Ai Tx | Last indexed: 2026-05-13 ---