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-asciimage

v0.1.5

Published

An ASCIImage component for React Native

Readme

react-native-asciimage

Provides an <ASCIImage /> component for React Native, powered by the excellent ASCIImage by @cparnot. It allows you to generate and insert images into your react-native app using ASCII art to describe the images (useful for small icons in UI elements).

Only iOS is currently supported.

Installation

  1. Run npm install react-native-asciimage --save
  2. Open your project in XCode, right click on Libraries and click Add Files to "Your Project Name" then choose the RNASCIImage.xcodeproj.
  3. Add libRNASCIImage.a to Build Phases -> Link Binary With Libraries.
  4. var ASCIImage = require('react-native-asciimage');
  5. Use the <ASCIImage/> element wherever you want to insert an image described by the ascii prop and optional color prop.

Usage

'use strict';

var React = require('react-native');
var ASCIImage = require('react-native-asciimage');
var { AppRegistry, View, Text } = React;

var myImage = [
  '· · · 1 2 · · · · · ',
  '· · · A # # · · · · ',
  '· · · · # # # · · · ',
  '· · · · · # # # · · ',
  '· · · · · · 9 # 3 · ',
  '· · · · · · 8 # 4 · ',
  '· · · · · # # # · · ',
  '· · · · # # # · · · ',
  '· · · 7 # # · · · · ',
  '· · · 6 5 · · · · · '
];

var App = React.createClass({

  render: function() {
    return (
      <View>
        <Text>
          ASCIImage Example:
        </Text>
        <ASCIImage ascii={myImage} />
      </View>
    );
  }

});

AppRegistry.registerComponent('App', () => App);

Result:

Alternate Usage

In some situations it's useful to work with an image URI rather than an Image component (e.g., for use in TabBarIOS.Item or NavigatorIOS). To generate a (local) image URI, do the following:

...
var ASCIImage = require('react-native-asciimage');
var ASCIImageWriter = ASCIImage.Writer;

ASCIImageWriter.createImageFromASCII(myImage, '#ffffff', 40, function(imageURI) {
  // Use the imageURI wherever it's needed
  console.log(imageURI);
});

This will create an image saved in your application's Caches directory for the specified color (example: #ffffff) and width (example: 40). It will automatically generate standard, @2x, and @3x sizes of the image, and will use cached images when they exist.

For advanced options (which would normally be passed in via the contextOptions prop), you can use the expanded form:

var options = [
  { fillColor: "rgba(0, 0, 0, 0)", lineWidth: 5 }, // First shape
  { fillColor: "#0000ff" } // Second shape
];

ASCIImageWriter.createImageFromASCIIWithOptions(myImage, '#ffffff', 40, options, function(imageURI) {
  console.log(imageURI);
}

Props

The following props are used:

  • ascii (Array) REQUIRED - an array of strings representing rows of the image (see the ASCIImage documention for details)
  • color (String) the color value to use for the foreground, e.g. #0000FF or rgba(0, 255, 0, 0.5). Default: #000000
  • contextOptions (Array) Array of options for advanced control over the drawing of each shape. Array indices correspond to the ASCIIContextShapeIndex for each shape passed to the underlying contextHandler block. Array values should be plain JavaScript objects with any of the following keys: fillColor, strokeColor, lineWidth, shouldClose, or shouldAntialias.

License

Available under the MIT license. See the LICENSE file for more informatiion.

ASCIImage (redistributed here) is also MIT licensed by Charles Parnot