react-native-sketchpad

react native sketchpad

Usage no npm install needed!

<script type="module">
  import reactNativeSketchpad from 'https://cdn.skypack.dev/react-native-sketchpad';
</script>

README

react-native-sketchpad

react native sketchpad

  

Installation

npm install react-native-sketchpad

Usage

example

import Sketchpad, { SoftBrush, HardBrush } from "react-native-sketchpad";

// ...
function App() {
  const pad = useRef();
  const brush = new SoftBrush(3, 7);
  const onClear = () => {
    pad.current?.clear();
  };
  const onUndo = () => {
    pad.current?.undo();
  };
  const onSave = () => {
    pad.current?.toDataURL((base64) => {
      // do save image
    });
  };
  return (
    <Sketchpad ref={pad} style={styles.pad} brush={brush} />
  );
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT