feat: add tui app
This commit is contained in:
33
packages/react-native-opentui/index.tsx
Normal file
33
packages/react-native-opentui/index.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import * as React from "react";
|
||||
import type { ViewProps, TextProps } from "react-native";
|
||||
|
||||
export function View({ children, style }: ViewProps) {
|
||||
const bg = style &&
|
||||
'backgroundColor' in style
|
||||
? typeof style.backgroundColor == 'string'
|
||||
? style.backgroundColor
|
||||
: undefined
|
||||
: undefined;
|
||||
return <box backgroundColor={bg}>{children}</box>
|
||||
|
||||
}
|
||||
|
||||
export function Text({ style, children }: TextProps) {
|
||||
const fg = style &&
|
||||
'color' in style
|
||||
? typeof style.color == 'string'
|
||||
? style.color
|
||||
: undefined
|
||||
: undefined;
|
||||
return <text fg={fg || "black"}>{children}</text>
|
||||
|
||||
}
|
||||
|
||||
export const Platform = {
|
||||
OS: "tui",
|
||||
};
|
||||
|
||||
export default {
|
||||
View,
|
||||
Text,
|
||||
}
|
||||
11
packages/react-native-opentui/package.json
Normal file
11
packages/react-native-opentui/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "react-native-opentui",
|
||||
"version": "1.0.0",
|
||||
"main": "index.tsx",
|
||||
"exports": {
|
||||
".": "./index.tsx"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*"
|
||||
}
|
||||
}
|
||||
12
packages/react-native-opentui/tsconfig.json
Normal file
12
packages/react-native-opentui/tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "@opentui/react",
|
||||
"strict": true,
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user