From 60796868f84e8cb2354b506c09b5c494fac9d944 Mon Sep 17 00:00:00 2001 From: szydlovsky <9szydlowski9@gmail.com> Date: Tue, 2 Sep 2025 15:48:23 +0200 Subject: [PATCH 1/4] feat: add readme --- README.md | 855 +++++++++++++++++++++++++++++++++++++- src/EnrichedTextInput.tsx | 6 +- 2 files changed, 846 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 35ee31491..58822bea7 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,859 @@ -# @swmansion/react-native-rich-text-editor +# react-native-enriched -Rich Text Editor component for React Native +`react-native-enriched` is a powerful React Native library that shares a rich text editor component: + +- ⚡ Fully native text input component +- đŸ•šī¸ Synchronous text styling +- 🔍 Live styling detection and html parsing +- 🎨 Customizable styles +- 📱 Mobile platforms support +- 🏛 Supports only the New Architecture + +`EnrichedTextInput`, the rich text editor component that the library shares is an uncontrolled input. This means that it doesn't use any state or props to store its value, but instead directly interacts with the underlying platform-specific components. Thanks to this, the component is really performant and simple to use while offering complex and advanced features no other solution has. + +Built by [Software Mansion](https://swmansion.com/) and sponsored by [Filament](https://filament.dm/). + +## Table of Contents + +1. [Prerequisites](#prerequisites) +2. [Installation](#installation) +3. [Usage](#usage) +4. [Simple Styles](#simple-styles) +5. [Links](#links) +6. [Mentions](#mentions) +7. [Inline Images](#inline-images) +8. [Style Detection](#style-detection) +9. [Other Useful Events](#other-useful-events) +10. [Customizing Styles](#customizing-styles) +11. [API Reference](#api-reference) +12. [Future Plans](#future-plans) +13. [Contributing](#contributing) +14. [License](#license) + +## Prerequisites + +- `react-native-enriched` currently supports only Android and iOS platforms +- It works only with [the React Native New Architecture (Fabric)](https://reactnative.dev/architecture/landing-page) and supports the 3 latest stable React Native releases, currently `0.79`, `0.80` and `0.81` ## Installation +### 1. Install the package + +#### npm + ```sh -npm install @swmansion/react-native-rich-text-editor +npm install react-native-enriched ``` +#### yarn + +```sh +yarn add react-native-enriched +``` + +#### expo + +```sh +npx expo install react-native-enriched +``` + +### 2. Install iOS dependencies + +```sh +cd ios && bundler install && bundler exec pod install +``` + +The library includes native code so you will need to re-build the native app to use it. + ## Usage +Here's a simple example of an input that lets you toggle bold on its text and shows whether bold is currently active via the button color. + +```tsx +import { EnrichedTextInput } from 'react-native-enriched'; +import type { + EnrichedTextInputInstance, + OnChangeStateEvent, +} from 'react-native-enriched'; +import React from 'react'; +import { View, Button, StyleSheet } from 'react-native'; +import type { NativeSyntheticEvent } from 'react-native'; + +export default function App() { + const ref = React.useRef(null); + const [stylesState, setStylesState] = + React.useState(); + + const toggleBold = () => { + ref.current?.toggleBold(); + }; + + const onChangeStateCallback = ( + e: NativeSyntheticEvent + ) => { + setStylesState(e.nativeEvent); + }; + + return ( + + +