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

@masumdev/rn-tajweed-verse

v0.1.1

Published

A highly customizable React Native and Expo component to parse and render Quranic verses with Tajweed color-coding, interactive tooltips, and themes.

Downloads

306

Readme

@masumdev/rn-tajweed-verse

A highly customizable React Native and Expo component to parse and render Quranic verses with Tajweed color-coding, interactive explainers, built-in themes, and custom styling rules.


Features

  • 📖 Quranic Markup Parsing: Automatically parses standard Quranic database tags (e.g. [q[خَلَقَ], [h:1[ٱ]) and renders them color-coded.
  • 💡 Interactive Tooltips: Tapping a colored word reveals Tajweed rule explanations and pronunciation guides.
  • 🎨 Theme Presets: Switch between built-in themes like Classic, Dark Mode, Soft Pastels, and High-Contrast Accessible.
  • 🚫 Plain Reading Mode: Easily toggle colors off to show clean, unstyled Arabic script.
  • 🛠️ Custom Rule Injection: Prepend custom RegExp patterns and styles (e.g. highlight specific phrases).
  • Performance Memoized: Wrapped in React.memo with custom shallow comparison checks to prevent heavy regex parsing cycles on parent re-renders.
  • 🔤 Style Inheritance Fix: Automatically resolves the React Native nested text bug where custom font family values fail to inherit down on Android/iOS.

Installation

Install the package via npm, yarn, or bun:

npm install @masumdev/rn-tajweed-verse
# or
yarn add @masumdev/rn-tajweed-verse
# or
bun add @masumdev/rn-tajweed-verse

Note: This package requires react-native-parsed-text which is installed automatically as a dependency.


Quick Start

import React, { useState } from "react";
import { View, StyleSheet, Alert } from "react-native";
import TajweedVerse, { TajweedThemes } from "@masumdev/rn-tajweed-verse";

export default function App() {
  const verseText =
    "بِسْمِ [h[ٱ]للَّهِ [h[ٱ][l[ل]رَّحْمَ[n[ـٰ]نِ [h[ٱ][l[ل]رَّح[p[ِي]مِ";

  return (
    <View style={styles.container}>
      <TajweedVerse
        verse={verseText}
        colored={true}
        interactive={true}
        config={{
          style: {
            fontSize: 28,
            fontFamily: "Amiri-Regular", // Optional custom font
            lineHeight: 56,
            direction: "rtl",
          },
          tajweed: TajweedThemes.classic, // classic, dark, pastel, accessible
        }}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
    padding: 20,
    backgroundColor: "#f8fafc",
  },
});

Config Props

| Prop | Type | Default | Description | | ------------- | -------------------- | --------------- | --------------------------------------------------------------------------------------- | | verse | string | "" | The raw Quranic verse text containing Tajweed markup (e.g., [q[خَلَقَ]). | | colored | boolean | true | When false, all tags are stripped and clean, uncolored Arabic is rendered. | | interactive | boolean | false | When true, tapping a colored word alerts the user with the rule details. | | config | TajweedVerseConfig | defaultConfig | Custom style configuration for the text and individual rules. | | onRulePress | function | undefined | Custom callback when a rule is pressed: (ruleName, description, matchedText) => void. | | customRules | ParseShape[] | undefined | Custom regex parser shapes to inject (runs before default rules). |


Styling & Themes

TajweedVerse exports a preset object TajweedThemes containing:

  1. classic: Standard Quran print color scheme.
  2. dark: High-vibrancy scheme tailored for dark screens.
  3. pastel: Soft color palette for modern interfaces.
  4. accessible: High-contrast, bolded, color-blind friendly scheme.

You can set it via props:

import TajweedVerse, { TajweedThemes } from "@masumdev/rn-tajweed-verse";

<TajweedVerse verse={verse} config={{ tajweed: TajweedThemes.pastel }} />;

Custom Rules Injection

You can inject custom parsing rules (following the react-native-parsed-text schema) to apply custom highlights or styles to specific words:

<TajweedVerse
  verse="This is a [custom[special word] inside text."
  customRules={[
    {
      pattern: /\[custom\[([^\]]+)\]/,
      style: {
        color: "#6366f1",
        fontWeight: "bold",
        textDecorationLine: "underline",
      },
      renderText: (text) => text.replace(/\[custom\[/, "").replace(/\]/, ""),
      onPress: (text) => Alert.alert("Tapped Highlight", text),
    },
  ]}
/>

🔤 Font Family Inheritance Fix

In React Native, nested <Text> components with their own styles (like colored Tajweed rules) fail to inherit fontFamily or lineHeight from their parent on Android and iOS.

Our package resolves this by merging the parent style configuration directly into the parsed sub-elements behind the scenes. This guarantees that your custom Arabic fonts (like Amiri or Noto Naskh) render uniformly across both standard text and color-coded rules!


License

MIT (c) 2026 Ma'sum / devmasum