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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@chuyenim/react-native-webview-rich-editor

v0.1.15

Published

A rich editor uses Webview, no additional libraries, no other dependencies.

Downloads

26

Readme

npm downloads version npm bundle size (minified + gzip) npm type definitions

Important announcement

"The @chuyenim/react-native-webview-rich-editor" is an open project and I'm no longer actively maintaining it."

@chuyenim/react-native-webview-rich-editor

@chuyenim/react-native-webview-rich-editor is a rich-text editor for react-native. We've created this library on top of Webview Api.

Prerequisite

This package is using react-native-webview. Please follow this document to install it.

Installation

Install using npm:

npm i @chuyenim/react-native-webview-rich-editor

Install using yarn:

yarn add @chuyenim/react-native-webview-rich-editor

Usage

Here is an example of how to use the RichTextInput component in your React Native project:

import React from "react";
import { useEffect, useRef, useState } from "react";
import { Button, ScrollView, Text, View } from "react-native";
import RichEditor, { RichEditorRef } from "@chuyenim/react-native-webview-rich-editor";

export default function HomeScreen() {
    const [plainHtml, setPlainHtml] = useState('<p>Hello,<br/>I am <strong>@Chris</strong></p><p><br/></p>');

    let editorRef = useRef<RichEditorRef>(null);

    useEffect(() => {
        console.log("plainHtml:", plainHtml);
    }, [plainHtml] );

    const handleFocus = () => {
        editorRef.current?.focus();
    };

    const handleBlur = () => {
        editorRef.current?.blur();
    };

    const handleInsertText = () => {
        editorRef.current?.insertHtml('<span class="mention">@Chris Nguyen</span> ');
    };

    const surroundSelectionTagBold = () => {
        editorRef.current?.toggleSelectionTag('strong');
    };

    const surroundSelectionTagItalic = () => {
        editorRef.current?.toggleSelectionTag('i');
    };

    const toggleSelectionTagH1 = () => {
        editorRef.current?.toggleSelectionTag('h1');
    };

    return (
        <ScrollView>
            <View style={{ padding: 16 }}>
                <View style={{ marginBottom: 20, padding: 10, backgroundColor: '#eee', minHeight: 20 }}>
                    <RichEditor ref={editorRef} value={plainHtml} onChange={setPlainHtml} bgColor={'#eee'} />
                </View>

                <Button onPress={handleFocus} title="Focus" />
                <Button onPress={handleBlur} title="Blur" />
                <Button onPress={handleInsertText} title="Insert HTML" />
                <Button onPress={surroundSelectionTagBold} title="Add Bold" />
                <Button onPress={surroundSelectionTagItalic} title="Add Italic" />
                <Button onPress={toggleSelectionTagH1} title="Add H1" />

            </View>
        </ScrollView>
    );
}

Props

  • value: The initial content to load into the editor.
  • onChange: A callback function that is called when the content of the editor changes.
  • placeholder: A placeholder text to display when the editor is empty.
  • customStyles: Custom styles to apply to the editor.
  • bgColor: Background color of the editor.
  • injectedCss: Custom CSS to inject into the editor.

Methods

The RichEditor component exposes the following methods via the ref:

  • focus(): Focuses the editor.
  • blur(): Blurs the editor.
  • setValue(html: string | null): Sets the HTML content of the editor.
  • insertHtml(html: string): Inserts the specified HTML at the current cursor position or at the end if no selection is made.
  • surroundSelection(before: string, after: string): Surrounds the current selection with the specified text.
  • surroundSelectionTag(tagName: string): Surrounds the current selection with the specified HTML tag.
  • toggleSelectionTag(tagName: string): Toggles the specified HTML tag around the current selection.
  • setPlaceholder(placeholder: string): Sets the placeholder text for the editor.
  • injectCss(css: string): Injects custom CSS into the editor.

Contributing

Feel free to contribute to the repository and the development workflow.

License

MIT