Visly

TwitterGithubBlogDocs

A high performance & cross-platform layout engine

Written in Rust

We chose to write stretch in the Rust programming language as it ensures memory safety, efficient multi-threading, and has fantastic cross-platform support.

Optimised for mobile

While stretch can be used on any platform we chose to optimize it for mobile. This means a small binary size and minimal memory usage.

Tested against Chrome

Stretch is tested against Chrome to ensure 100% web compatibility. You can trust stretch to layout your native apps exactly like your web apps.

Cross platform

main.rs
use stretch::{style::*, node::Node, geometry::Size};

let node = Node::new(Style {
    size: Size { 
        width: Dimension::Points(100.0), 
        height: Dimension::Points(100.0),
    },
    ..Default::default()
}, vec![]);

let layout = node.compute_layout(Size::undefined());
index.js
import { Node } from 'stretch-layout';

const node = new Node({
    width: 100, 
    height: 100, 
});

const layout = node.computeLayout({
    width: undefined,
    height: undefined,
});
Main.swift
let node = Node(
    style: Style(
        size: Size(
            width: .points(100.0), 
            height: .points(100.0)
        )
    ), 
    children: []
)
    
let layout = node.computeLayout(
    thatFits: Size(width: nil, height: nil)
)
Main.kt
val node = Node(
    Style(
        size = Size(
            Dimension.Points(100f), 
            Dimension.Points(100f)
        )
    ), 
    listOf()
)

val layout = node.computeLayout(
    Size(null, null)
)