New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

revas

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

revas

Build Apps on Canvas, with React and Flexible CSS, inspired by react-canvas

latest
Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
 
Created
Source


npm version

Use React and CSS to build UI interfaces on canvas

Document | 中文文档 | Live DEMO | DEMO Code

Requirements

  • React 19.x (peer dependency)

Install

$ pnpm add revas react@19

Usage

Render to a DOM

import React from 'react'
import {render, View, Text} from 'revas'

render(
  <View style={{ flex: 1 }}>
    <Text style={{ fontSize: 20 }}>Revas</Text>
  </View>,
  document.getElementById('container')
)

Edit purple-browser-h56ht

Render to a DOM rendered by React

import React from 'react'
import {render, View, Text} from 'revas'

export class Widget extends React.Component {
  componentDidMount() {
    this.app = render(
      <View style={{ flex: 1 }}>
        <Text style={{ fontSize: 20 }}>Revas</Text>
      </View>,
      document.getElementById('container'),
      this
    )
  }
  componentDidUpdate() {
    this.app.update()
  }
  componentWillUnmount() {
    this.app.unmount()
  }
  render() {
    return <div id="container" />
  }
}

Edit reverent-river-vbypp

Render to a custom canvas api

DEMO

Upgrading from v1.x to v2.x

Revas 2.0 is a major upgrade with breaking changes:

Breaking Changes

Changev1.xv2.x
React versionReact 17.xReact 19.x (required)
Layout engineyoga-layout-wasm (async)yoga-layout 3.x (sync)
Module formatCJS + ESMESM-first with CJS fallback

What You Need to Do

  • Upgrade React to version 19.x:

    pnpm add react@19 react-dom@19
    
  • Update imports (if using /common export):

    // No changes needed - API is the same
    import { View, Text } from 'revas'
    import { View, Text } from 'revas/common'
    

Layout Engine Changes

The layout engine has been upgraded from yoga-layout-wasm to yoga-layout 3.x:

  • For most users: No changes needed. The style API remains the same.
  • Performance: Layout calculation is now synchronous (no async initialization).
  • Bundle size: Slightly larger due to WASM being bundled differently.

Supported Flexbox properties (unchanged):

  • Layout: flex, flexDirection, justifyContent, alignItems, alignSelf, flexWrap
  • Sizing: width, height, minWidth, maxWidth, minHeight, maxHeight
  • Spacing: padding, margin, borderWidth
  • Positioning: position (relative, absolute, static), top, left, right, bottom

For full style reference, see style.ts.

For Custom Canvas Platforms

If you're using Revas on custom platforms (WeChat mini-games, ByteDance games), the revas/common export now uses synchronous yoga-layout. Remove any async initialization code:

// v1.x (old)
import { initYoga } from 'revas/common'
await initYoga()  // ❌ No longer needed

// v2.x (new)
import { render } from 'revas/common'
render(...)  // ✅ Works immediately

Other Framework

Keywords

react

FAQs

Package last updated on 14 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts