Revas Document

January 14, 2026 ยท View on GitHub

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

Components

View

ViewProps

PropertyTypeDescription
styleViewStyleInline css
pointerEvents'auto' | 'box-none' | 'none'
onLayout(Frame): voidx, y, width, height
onTouchStart(RevasTouch): voidcallback
onTouchMove(RevasTouch): voidcallback
onTouchEnd(RevasTouch): voidcallback
cacheboolean | stringenable offscreen cache
forceCachebooleanforce enable cache
<View {...props} />

Text

TextProps

extends ViewProps

PropertyTypeDescription
styleTextStyleInline css
numberOfLinesnumbermax lines
<Text numberOfLines={1}>Hello World</Text>

Image

ImageProps

extends ViewProps

PropertyTypeDescription
styleImageStyleInline css
srcstringImage source url
<Image src="https://some.img/url.jpg" />

Touchable

TouchableProps

extends ViewProps

PropertyTypeDescription
onPressFunctioncallback
onPressInFunctioncallback
onPressOutFunctioncallback
activeOpacitynumberopacity when pressing in
<Touchable onPress={() => alert('Enjoy!~๐ŸŽ‰')}>
  <Text>Go</Text>
</Touchable>

ScrollView

ScrollViewProps

extends ViewProps

PropertyTypeDescription
horizontalbooleandirection
onScroll(RevasScrollEvent): voidscrolling callback
onScrollStart(RevasScrollEvent): voidscroll start
onScrollEnd(RevasScrollEvent): voidscroll end
pagingboolean | numberenable paging, and the length
offset{x: number, y: number}offset
<ScrollView>
  {colors.map(renderColorItem)}
</ScrollView>

LinearGradient

LinearGradientProps

extends ViewProps

PropertyTypeDescription
start{x: number, y: number}start position
end{x: number, y: number}end position
colorsColor[]colors
<LinearGradient style={styles.decorator}
  start={{x: 0, y, 0}} end={{x: 1, y, 0}} 
  colors={['#9254DE', '#B37FEB', '#91D5FF', '#40A9FF']} />

ListView

ListViewProps

extends ScrollViewProps

PropertyTypeDescription
dataT[]list data
renderItem(item, index, data): JSXrender item
itemHeightnumberheight of each item
<ListView
  data={[1, 2, 3, 4, 5, 12, 123, 1, 23, 2]}
  getItemHeight={() => 80} renderItem={(item, index) => (
    <View style={{ height: 80, backgroundColor: (index % 2) > 0 ? 'white' : 'black' }} />
  )} />

API

render(app: JSX, target: DOM): Renderer

[WEB ONLY] render to a DOM container

new AnimatedValue(number)

animated value

import { AnimatedValue } from 'revas'

const translateX = new AnimatedValue(0)

function Comp() {
  return <View 
    style={{
      translateX: translateX
    }}
    onTouchMove={e => {
      translateX.setValue(e.touches[0].x)
    }}
  />
}

timing(AnimatedValue, Config).start().stop()

start a animation

AnimatedValue.interpolate(inputRange: number[], outputRange: number[])

interpolate animated value

withContext(Component)

inject context to a component

clientWidth, clientHeight, pixelRatio, canvas

CSS

CategoryStyles
Flexible Layoutwidth, minWidth, maxWidth, height, minHeight, maxHeight, padding, paddingLeft, margin, marginLeft, position, left, top, flex, flexDirection, justifyContent, alignItems ...more
BoxborderRadius, borderWidth, borderColor, borderTopLeftRadius, shadowColor, shadowOffsetX, shadowOffsetY, shadowBlur, backgroundColor, overflow, opacity
TextfontFamily, fontSize, fontWeight, color, lineHeight, textAlign, wordBreak, fontStyle, textBaseline, textShadowBlur, textShadowColor, textShadowOffsetX, textShadowOffsetY
ImageresizeMode
TransformtranslateX, translateY, rotate, scale, scaleX, scaleY
Otheranimated, path

Upgrading from v1.x

See the upgrade guide for breaking changes and migration steps.

Key changes:

  • React 19.x required (was React 17.x)
  • Layout engine: yoga-layout 3.x replaces yoga-layout-wasm (now synchronous)
  • No API changes: Style properties and components remain the same

Render to a custom canvas

TODO