nsh-cli 0.2.0

The nsh command line tool: build, package and run apps.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { mount, signal, Text } from "nsh";
import { SafeAreaView } from "nsh/base";
import { Badge, Counter, Format } from "__SPECIFIER__";

// Its count lives in Rust (`src/lib.rs`).
const counter = new Counter();

function App() {
  const count = signal(counter.count);
  return (
    <SafeAreaView style={{ flex: 1, alignItems: "center", justifyContent: "center", gap: 16 }}>
      <Text style={{ fontSize: 22 }}>{count() ? `Pressed ${Format.times(count())}` : "Not pressed yet"}</Text>
      <Badge label="Press me" onPress={() => count.set(counter.increment())} />
    </SafeAreaView>
  );
}

mount(App);