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

@canvas-tile-engine/react-native

v0.5.0

Published

React Native bindings for Canvas Tile Engine - interactive 2D grid-based maps with Skia

Readme

@canvas-tile-engine/react-native

npm version license

React Native bindings for Canvas Tile Engine, rendered with @shopify/react-native-skia.

The API mirrors @canvas-tile-engine/react: same useCanvasTileEngine hook, same <CanvasTileEngine> component, same compound draw components, same camera and draw APIs. The differences are the renderer (RendererSkia), styling (ViewStyle), native touch input behind the same callbacks, and image handles (SkImage instead of HTMLImageElement).

Install

Expo:

npx expo install @shopify/react-native-skia
npm install @canvas-tile-engine/core @canvas-tile-engine/react-native @canvas-tile-engine/renderer-skia

Bare React Native:

npm install @canvas-tile-engine/core @canvas-tile-engine/react-native @canvas-tile-engine/renderer-skia @shopify/react-native-skia
cd ios && pod install

@shopify/react-native-skia is a native module and must be a direct dependency of your app so autolinking includes it in development and release builds. Skia also requires react-native-reanimated; follow the Skia installation guide for your React Native setup.

Quick Start

import { CanvasTileEngine, useCanvasTileEngine } from "@canvas-tile-engine/react-native";
import { RendererSkia } from "@canvas-tile-engine/renderer-skia";

export function NativeMap() {
    const engine = useCanvasTileEngine();

    return (
        <CanvasTileEngine
            engine={engine}
            renderer={new RendererSkia()}
            config={{
                scale: 32,
                minScale: 8,
                maxScale: 96,
                size: { width: 0, height: 0 },
                backgroundColor: "#0f172a",
                eventHandlers: { drag: true, zoom: true, click: true },
            }}
            style={{ flex: 1 }}
            onClick={(coords) => console.log("Tapped:", coords.snapped)}
        >
            <CanvasTileEngine.GridLines cellSize={1} strokeStyle="#1e293b" layer={0} />
            <CanvasTileEngine.Circle items={{ x: 0, y: 0, size: 0.8, style: { fillStyle: "#22d3ee" } }} layer={1} />
        </CanvasTileEngine>
    );
}

The config.size value is only a placeholder. The component measures its wrapping View with onLayout and resizes the engine to fill it, so { width: 0, height: 0 } is expected.

Components

The same draw components are available on native:

Rect, Circle, Image, Sprite, GridLines, Line, Text, Path, StaticRect, StaticCircle, StaticImage, and DrawFunction.

For large arrays, keep items stable with useMemo or state. A new array identity re-registers the draw callback and can rebuild spatial indexes.

Imperative Access

import { useEffect } from "react";
import { CanvasTileEngine, useCanvasTileEngine } from "@canvas-tile-engine/react-native";
import { RendererSkia } from "@canvas-tile-engine/renderer-skia";

export function ImperativeNativeMap() {
    const engine = useCanvasTileEngine();

    useEffect(() => {
        if (!engine.isReady) return;

        engine.drawGridLines(1, 1, "#334155", 0);
        engine.drawRect({ x: 1, y: 1, size: 1, style: { fillStyle: "#4ade80" } }, 1);
        engine.render();
    }, [engine, engine.isReady]);

    return <CanvasTileEngine engine={engine} renderer={new RendererSkia()} config={config} style={{ flex: 1 }} />;
}

Images And Sprites

Use engine.loadImage(uri) to decode a URI into a Skia SkImage.

import { useEffect, useMemo, useState } from "react";
import { CanvasTileEngine, SpriteSheet, type EngineHandle, type SkImage } from "@canvas-tile-engine/react-native";

function UnitLayer({ engine }: { engine: EngineHandle }) {
    const [img, setImg] = useState<SkImage | null>(null);
    const sheet = useMemo(() => new SpriteSheet({ frameWidth: 32, frameHeight: 32, columns: 8 }), []);
    const frames = useMemo(() => sheet.framesInRow(0, 0, 5), [sheet]);

    useEffect(() => {
        if (engine.isReady) engine.loadImage("https://example.com/unit.png").then(setImg);
    }, [engine, engine.isReady]);

    if (!img) return null;

    return <CanvasTileEngine.Sprite items={{ x: 4, y: 2, size: 1, img }} frames={frames} fps={8} layer={2} />;
}

Web vs Native

| Concern | React web | React Native | | ------------------- | ----------------------------------------------- | -------------------------------------------- | | Renderer | RendererCanvas or RendererWebGL | RendererSkia | | Mount | <div><canvas /></div> | Skia <Canvas> inside a <View> | | Styling | className / CSSProperties | ViewStyle | | Images | HTMLImageElement | SkImage | | Custom draw context | CanvasRenderingContext2D or overlay context | SkCanvas | | Input | DOM mouse/touch/wheel behind the same callbacks | Native touch input behind the same callbacks |

Everything else - hook handle, draw components, layers, culling, camera math, coordinate callbacks, and sprite helpers - is shared.

Notes

  • config, center, and renderer are read when the native engine is created. Remount with a new key to apply a new full config or renderer.
  • Use engine.setEventHandlers, engine.setBounds, engine.setCenter, engine.goCenter, engine.setScale, zoomIn, and zoomOut for runtime changes.
  • onDraw and DrawFunction receive a Skia SkCanvas.
  • Static draw helpers record and replay Skia pictures, which is useful for thousands of non-changing items.

Documentation

License

MIT