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

react-native-draw-view

v1.0.0

Published

Provice a native UI component to draw onto.

Readme

react-native-draw-view

A React Native component for free-hand drawing on both iOS and Android.

Features

  • 👆 Draw with your finger and export an image from it.
  • 💾 Save your sketch to image.
  • 🖍 Change the stroke color and thickness of the pen easily.
  • 👻 Full-customize UI.

Setup

Install the module from npm:

npm i --save react-native-draw-view

Link the module to your project:

react-native link react-native-draw-view

Note: For iOS, if you're using CocoaPod, remember to cd ios && pod install after link. Or you can manual link follow this instruction.

Important for iOS: Because the source code is written in Swift, so if your project doesn't include any .swift file, please open your project in XCode, create a file anyname.swift, accept to create the bridging header, then just leave it empty is ok.

Usage

import React from 'react';
import { View } from 'react-native';
import DrawView from 'react-native-draw-view';

export default class MyScreen extends React.Component {
  drawer;

  save = () => {
    this.drawer.save()
  }

  reset = () => {
    this.drawer.reset();
  }

  render() {
    return (
      <View style={{ flex: 1 }}>
        <DrawView
          style={{ flex: 1, backgroundColor: '#eee' }}
          onRef={el => this.drawer = el}
          color="#000"
          strokeWidth={2}
          onSaved={res => console.log('Save', res.nativeEvent)}
          onError={error => console.log('Error', error.nativeEvent)} />
        <View style={{ flexDirection: 'row', justifyContent: 'space-around' }}>
          <Button title="Reset" onPress={this.reset} />
          <Button title="Save" onPress={this.save} />
        </View>
      </View>
    );
  }
}

API

Here are the props of the the component:

| Name | Type | Default value | Comment | | ---- | ---- | ------------- | ---- | | color | String | '#000000' | The stroke color you want to draw with. | | strokeWidth | Number | 1 | The stroke thickness, in pixels. | | style | Style object | null | Some View styles if you need. | | onRef | Function | null | Bind draw view's ref to your variable. | | onSaved | Function | null | Event called after the draw's saved successfully. The return value is an object res which res.nativeEvent include file's information: uri, mimetype, size, name. | | onError | Function | null | Event called if there is error. The return value is an object err which err.nativeEvent include message of that error. |

The component also has some instance methods:

| Name | Return type | Comment | | ---- | ----------- | ------- | | reset() | Promise | Reset the drawing. You could simply type: this.sketch.clear(); | | save() | Promise | Save the drawing to an image. The result's returned by onSaved event.` |

Contributing

Feel free to contribute by sending a pull request or creating an issue.

License

MIT