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

react-native-kanjivg

v0.0.9

Published

React Native SVG components based on KanjiVG

Readme

react-native-kanjivg

⚠️ This library is in active development. It's API is subject to change in future versions without notice.

React Native SVG components to display Kanji characters in applications. Based on KanjiVG's dataset.

Each component exposes fine-level control over the SVG rendering with features like:

  • Showing/hiding individual strokes
  • Showing/hiding stroke order
  • Styling individual strokes
  • Styling stroke order
  • Animation support (using something like react-native-reanimated
  • lazy component initialization (to prevent loading the entire character dataset)
  • etc.

Setup

# Install the package using your package manager of choice
npm install react-native-kanjivg
# or
yarn add react-native-kanjivg
# or
pnpm add react-native-kanjivg
# etc...

Usage

Basic Usage

Rendering a single character

import React from "react";
import { View } from "react-native";

import { Kanji } from "react-native-kanjivg";

export const MyComponent: React.FC = () => {
  return (
    <View>
      <Kanji character={"魂"} width={100} height={100} />
    </View>
  );
};

Style how the character is rendered

Strokes can be styled using the kStroke ("kanjiStroke") prop. This accepts PathProps from react-native-svg which are applied to all the strokes of the character.

Stroke order numbers can be styled using the oNumber prop. This accepts TextProps from react-native-svg which are applied to all numbers of the character.

import React from "react";
import { View } from "react-native";

import { Kanji } from "react-native-kanjivg";

export const MyComponent: React.FC = () => {
  return (
    <View>
      <Kanji
        character={"魂"}
        width={100}
        height={100}
        kStroke={{
          color: "#333",
          strokeWidth: 2,
          // etc.
        }}
        oNumber={{
          // Hide all stroke order numbers
          fill: "transparent",
        }}
      />
    </View>
  );
};

Advanced Usage

Styling specific strokes

To style a specific stroke, you can use the kStrokes prop. This accepts an object with stroke numbers as keys and PathProps from react-native-svg as values. Values provided here will override general set values specified in kStroke.

import React from "react";
import { View } from "react-native";

import { Kanji } from "react-native-kanjivg";

export const MyComponent: React.FC = () => {
  return (
    <View>
      <Kanji
        character={"魂"}
        width={100}
        height={100}
        kStroke={{
          color: "#333",
          strokeWidth: 2,
          // etc.
        }}
        kStrokes={{
          // Make ONLY the second stroke red
          2: {
            color: "red",
          },
        }}
      />
    </View>
  );
};

Animation

Complex animations can be achieved by using the kStrokes prop along with the withCustomComponent function. This function allows you to provide a custom Path component for the stroke to use. This flexibility isn't limited to animations, it effectively allows you complete control over each stroke's rendering.

The following example shows how to make the 2nd stroke "glow":

import React, { useEffect } from "react";
import { View } from "react-native";
import Animated, { Easing, useAnimatedProps, useSharedValue, withRepeat, withTiming } from "react-native-reanimated";

import { Kanji, withCustomComponent } from "react-native-kanjivg";

// Create an animated version of the SVG Path component
const AnimatedPath = Animated.createAnimatedComponent(Path);

// Dark red → bright red color stops
const DARK_RED = "#8B0000";
const BRIGHT_RED = "#FF0000";

// Duration of one half-cycle (dark → bright) in ms
const GLOW_DURATION = 1000;

export const MyComponent: React.FC = () => {
  // Shared value driving the color interpolation (0 → 1 → 0 → …)
  const progress = useSharedValue(0);

  useEffect(() => {
    // Ping-pong between 0 and 1 forever
    progress.value = withRepeat(
      withTiming(1, { duration: GLOW_DURATION, easing: Easing.inOut(Easing.ease) }),
      -1, // infinite repeats
      true, // reverse each cycle
    );
  }, [progress]);

  // Animated props that map progress → stroke color on the first path
  const animatedProps = useAnimatedProps(() => ({
    stroke: interpolateColor(progress.value, [0, 1], [DARK_RED, BRIGHT_RED]),
  }));

  return (
    <View>
      <Kanji
        character={"魂"}
        width={100}
        height={100}
        kStroke={{
          color: "#333",
          strokeWidth: 2,
          // etc.
        }}
        kStrokes={{
          // Make ONLY the second stroke red
          2: withCustomComponent({
            color: "red",
            Component: AnimatedPath,
            animatedProps,
          }),
        }}
      />
    </View>
  );
};

LICENSE

This library is released under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Attribution

This project is based on the KanjiVG SVG dataset.