npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-rich-text-fabric

v0.1.2

Published

implement rich text and rich input

Downloads

254

Readme

react-native-rich-text-fabric

A high-performance rich text display and input component library for React Native, built with the new Fabric architecture.

✨ Features

  • 🚀 Pure Native Implementation - No WebView, no third-party dependencies
  • 📝 RichText - Display component with mixed text and images
  • ✏️ RichTextInput - Native input with image insertion and text styling
  • 🏷️ @ Mention Support - Atomic text deletion for @mention scenarios
  • 🎨 Customizable Styles - Font, color, bold, italic, underline, background
  • 📱 Cross Platform - iOS and Android support

📸 Preview

RichTextInput Example

📦 Installation

npm install react-native-rich-text-fabric
# or
yarn add react-native-rich-text-fabric

🚀 Quick Start

RichText - Display Component

import { RichText } from 'react-native-rich-text-fabric';

const content = [
  { type: 'text', text: 'Hello, ' },
  {
    type: 'text',
    text: 'World!',
    textStyle: { fontWeight: 'bold', color: 'red' },
  },
  {
    type: 'image',
    image: 'https://example.com/emoji.png',
    imageStyle: { width: 20, height: 20 },
  },
];

<RichText content={content} />;

RichTextInput - Input Component

import { useRef } from 'react';
import {
  RichTextInput,
  type RichTextInputRef,
} from 'react-native-rich-text-fabric';

const ref = useRef<RichTextInputRef>(null);

<RichTextInput
  ref={ref}
  placeholder="Enter rich text..."
  onContentChange={(content) => console.log(content)}
/>;

// Insert styled text
ref.current?.insertText({
  text: 'styled',
  textStyle: { fontWeight: 'bold', color: 'blue' },
});

// Insert image
ref.current?.insertImage({
  image: 'https://example.com/image.png',
  imageStyle: { width: 24, height: 24 },
});

RichTextInput - @ Mention Feature

import { useRef } from 'react';
import {
  RichTextInput,
  generateAtomicId,
  type RichTextInputRef,
} from 'react-native-rich-text-fabric';

const ref = useRef<RichTextInputRef>(null);

// Insert @mention with atomic deletion support
const insertMention = (userId: string, userName: string) => {
  ref.current?.insertText({
    text: `@${userName} `,
    textStyle: { color: '#1890ff' },
    atomicId: userId, // Enables atomic deletion - the entire @mention deletes as one unit
  });
};

<RichTextInput
  ref={ref}
  placeholder="Type @ to mention someone..."
  onContentChange={(content) => {
    // content includes atomicId for @mentions
    console.log(content);
  }}
/>;

📖 API Reference

RichText Props

| Prop | Type | Description | | ------------------- | ---------------------------------------------------------- | ------------------- | | content | Array<string \| RichTextStringItem \| RichTextImageItem> | Content array | | defaultTextStyle | TextStyle | Default text style | | defaultImageStyle | ImageStyle | Default image style |

RichTextInput Props

| Prop | Type | Default | Description | | ------------------------ | ------------------------------------------ | ------- | ------------------------------ | | placeholder | string | - | Placeholder text | | placeholderTextColor | ColorValue | - | Placeholder color | | multiline | boolean | true | Enable multiline | | maxLength | number | - | Maximum character length | | editable | boolean | true | Enable editing | | autoFocus | boolean | false | Auto focus on mount | | defaultTextStyle | TextStyle | - | Default text style | | defaultImageStyle | ImageStyle | - | Default image style | | inheritInsertedStyle | boolean | true | Inherit style after insertText | | cursorColor | ColorValue | - | Cursor color | | imagePlaceholderColor | ColorValue | - | Image placeholder background | | imagePlaceholderSource | ImageSourcePropType | - | Image placeholder image | | onContentChange | (content: RichTextContentItem[]) => void | - | Content change callback | | onFocus | () => void | - | Focus callback | | onBlur | () => void | - | Blur callback |

RichTextInput Ref Methods

| Method | Description | | ------------------------ | -------------------------------------------- | | focus() | Focus the input | | blur() | Blur the input | | isFocused() | Returns focus state | | insertText(text) | Insert text with optional style and atomicId | | insertImage(image) | Insert image | | clearContent() | Clear all content | | getContent() | Get current content | | setCursorPosition(pos) | Set cursor position |

🔧 Requirements

  • React Native >= 0.83
  • New Architecture (Fabric) enabled
  • iOS 13.0+
  • Android SDK 24+

📱 Platform Support

| Feature | iOS | Android | | ----------------------- | --- | ------- | | RichText Display | ✅ | ✅ | | RichTextInput | ✅ | ✅ | | Image Insertion | ✅ | ✅ | | Text Styling | ✅ | ✅ | | Atomic Text (@ Mention) | ✅ | ✅ | | Custom Cursor Color | ✅ | ✅ | | Image Placeholder | ✅ | ✅ |

📚 Alternatives

Rich Text Editors (WebView-based):

Rich Text Editors (Native):

@ Mention Components:

🗺️ Roadmap

  • [x] AtTextInput - @ mention input component
  • [x] UserList - User selection popup component
  • [x] RichText - Rich text display with mixed text/images
  • [x] RichTextInput - Native rich text input
  • [x] Text styling support (color, bold, italic, underline, background)
  • [x] Atomic text (@ mention with atomic deletion)
  • [x] Style inheritance control (inheritInsertedStyle)
  • [x] Custom cursor color
  • [x] Image placeholder support
  • [x] Hyperlink support for RichText
  • [ ] Playground / Online demo
  • [ ] Cloud build for example project

🤝 Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

We have templates to help you get started:

🔒 Security

For information about reporting security vulnerabilities, please see our Security Policy.

📄 License

MIT


Made with ❤️ by AsteriskZuo