Vi: a beginner-friendly language for building React Native apps
Vi is an open-source language and IDE for building real React Native apps with less UI code. You describe each part of a screen in plain words; Vi compiles it to React Native (Expo) for Android, iOS and the web. When you need more, TypeScript and any npm package are right there.
The same screen in Vi and in React Native
A counter: a big purple number and a round button that adds one. On the left in Vi, on the right written by hand in React Native with JSX and a style sheet.
Vi (main.vi)
count = 0
main home:
color: white
arrange: center
space_between: 16
children:
big_number
plus_button
big_number:
text: "{count}"
text_style: 72, bold, purple
plus_button:
size: 20
color: purple
shape: circle
arrange: center
on_tap: count = count + 1
children:
plus_icon
plus_icon:
icon: plus
color: white
React Native (App.tsx, by hand)
import { useState } from 'react';
import {
View, Text, Pressable, StyleSheet,
} from 'react-native';
import { Ionicons } from '@expo/vector-icons';
export default function App() {
const [count, setCount] = useState(0);
return (
<View style={styles.home}>
<Text style={styles.bigNumber}>
{count}
</Text>
<Pressable
style={styles.plusButton}
onPress={() => setCount(count + 1)}>
<Ionicons name="add" size={32}
color="white" />
</Pressable>
</View>
);
}
const styles = StyleSheet.create({
home: {
flex: 1, backgroundColor: 'white', gap: 16,
alignItems: 'center', justifyContent: 'center',
},
bigNumber: {
fontSize: 72, fontWeight: 'bold', color: 'purple',
},
plusButton: {
width: '20%', aspectRatio: 1,
borderRadius: 9999,
backgroundColor: 'purple',
alignItems: 'center', justifyContent: 'center',
},
});
No imports, hooks, style objects or closing tags: a beginner reads the Vi version top to
bottom. size: 20 means 20 % of the parent's width, arrange: center
centres the children both ways, and changing count redraws whatever uses it.
What Vi compiles to
This is the App.tsx the Vi compiler writes for the counter above, unedited. Each
Vi container becomes a React component; a small runtime (Box, vi.state)
turns the attributes into React Native views and styles, and makes state reactive.
// Generated by Vi from main.vi. Do not edit: changes are overwritten.
import React from 'react';
import { vi, Box, ViApp, type Ctx, type Ref } from './vi/runtime';
// ── Config ───────────────────────────
const CONFIG: any = vi.config({});
// ── State (top-level variables) ──────
const S: any = vi.state({
count: 0,
});
// ── Containers ───────────────────────
function Home() {
return (
<Box name="home" attrs={() => ({ color: 'white', arrange: 'center', space_between: 16 })}>
<Big_number />
<Plus_button />
</Box>
);
}
function Big_number() {
return (
<Box
name="big_number"
attrs={() => ({
text: `${vi.str(S.count)}`,
text_style: [72, 'bold', 'purple'],
})}
/>
);
}
function Plus_button() {
return (
<Box
name="plus_button"
attrs={() => ({
size: 20,
color: 'purple',
shape: 'circle',
arrange: 'center',
on_tap: () => { S.count = S.count + 1; },
})}
>
<Plus_icon />
</Box>
);
}
function Plus_icon() {
return <Box name="plus_icon" attrs={() => ({ icon: 'plus', color: 'white' })} />;
}
export default function App() {
return <ViApp main={Home} screens={{ home: Home }} config={CONFIG} />;
}
The output is an ordinary Expo project. Studio can export it, so you are never locked in: keep working on it in plain React Native whenever you like.
TypeScript and npm packages, for what Vi doesn't cover
.js, .ts and .tsx files in a project's src/
folder join the app like .vi files, with no imports. Exported functions can be
called from Vi, and a function that returns JSX becomes a container you can place in
children:. Packages listed in config: packages: are installed for you.
src/js/party.ts
export function celebrate() { … }
export function sales_chart({ data }) { return <BarChart data={data} />; }
src/main.vi
config:
packages: "react-native-gifted-charts"
win():
celebrate()
report:
children:
sales_chart(monthly_sales)
Why a language, not a component library
Readable by beginners
Screens read like a description: what a part is, how it looks, what it does when tapped. Errors are explained in plain words.
An editor that understands it
Vi Studio knows every attribute, so it completes, checks and explains as you type, and can jump from the running app to the code that drew it.
Live everywhere
The compiler runs in the browser, so the app preview updates on every keystroke, even on a phone with no install.
Still React Native
Expo builds for Google Play and the App Store, the whole npm ecosystem, and code you can take with you.