Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/asteriskzuo/react-native-ease-rich-text


https://github.com/asteriskzuo/react-native-ease-rich-text

Last synced: about 5 hours ago
JSON representation

Awesome Lists containing this project

README

        

# react-native-ease-rich-text

Implement rich text components. Including input components and display components.

## Installation

```sh
npm install react-native-ease-rich-text
```

## Usage

1. How to use rich text display components.

```tsx
import { multiply } from 'react-native-ease-rich-text';

// ...

const ref = React.useRef({} as RichTextRef);
;

// ...

ref.current?.pushText('push text');
ref.current?.pushImage(require('../assets/1.png'), {
width: 20,
height: 20,
});
```

2. How to use rich text input components.

```tsx
import { multiply } from 'react-native-ease-rich-text';

// ...

const ref = React.useRef({} as RichInputRef);
;

// ...

ref.current?.pushText('push text');
ref.current?.pushImage(
{
uri: 'https://cdn2.iconfinder.com/data/icons/chinese-new-year/512/gcds-dragon.png',
},
{
width: 20,
height: 20,
}
);
```

3. How to pass text from input component to display component.

```tsx
// ...
const list = inputRef.current?.getData();
displayRef.current?.pushData(list);
```

## Remark

The current version is not perfect and only supports text and pictures. It will be updated in the future. If you like it or have the structure and ideas, you can help improve it together.

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT

---

Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)