Web Analytics

react-native-nitro-text

⭐ 200 stars Japanese by patrickkabwe

react-native-nitro-text

iOSとAndroidの両方で、よりリッチで高性能なTextコンポーネント。

https://github.com/user-attachments/assets/57f56b3f-3988-4235-af83-a5f2cfd82121

npm version Discord npm downloads npm downloads mit licence


特徴

動作環境

インストール

yarn add react-native-nitro-text react-native-nitro-modules

iOS

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は、テキストが選択されたときに表示されるカスタムメニュー項目をサポートしています。menusプロパティに、titleactionコールバックを含むメニュー項目の配列を渡します。

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. ) }

プラットフォームサポート

なぜ NitroText か?

最小限のJSオーバーヘッドとネイティブiOS選択機能を備えたカスタムネイティブテキストビュー。重い/入れ子状のスタイルテキストや大規模リストに最適です。RNの Text コンポーネントのドロップイン置換です。

開発

クレジット

create-nitro-module でブートストラップされました。

コントリビューション

PRは歓迎します!大きな変更はまずIssueを開いてください。

💬 迅速なサポートは、Discordチャンネルにご参加ください。

--- Tranlated By Open Ai Tx | Last indexed: 2026-05-13 ---