diff --git a/README.md b/README.md index 35ee31491..942101804 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,864 @@ -# @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. [Non Parametrized Styles](#non-parametrized-styles) +5. [Links](#links) +6. [Mentions](#mentions) +7. [Inline Images](#inline-images) +8. [Style Detection](#style-detection) +9. [Other Events](#other-events) +10. [Customizing \ styles](#customizing-enrichedtextinput--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 +### Bare react native app + +#### 1. Install the library + +```sh +yarn add react-native-enriched +``` + +#### 2. Install iOS dependencies + +The library includes native code so you will need to re-build the native app to use it. + +```sh +cd ios && bundler install && bundler exec pod install +``` + +### Expo app + +#### 1. Install the library + ```sh -npm install @swmansion/react-native-rich-text-editor +npx expo install react-native-enriched ``` +#### 2. Run prebuild + +The library includes native code so you will need to re-build the native app to use it. + +```sh +npx expo prebuild +``` + +> [!NOTE] +> The library won't work in Expo Go as it needs native changes. + ## 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 { useState, useRef } from 'react'; +import { View, Button, StyleSheet } from 'react-native'; + +export default function App() { + const ref = useRef(null); + + const [stylesState, setStylesState] = useState(); + + return ( + + setStylesState(e.nativeEvent)} + style={styles.input} + /> +