Skip to content

Commit 2f54cd5

Browse files
committed
feat: app setups
1 parent 3060621 commit 2f54cd5

82 files changed

Lines changed: 11244 additions & 1540 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/demo-angular/package-lock.json

Lines changed: 38 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/demo-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"@nstudio/nstreamdown": "file:../../packages/nstreamdown"
99
},
1010
"devDependencies": {
11-
"@nativescript/ios": "9.0.4-next.2026-01-04-20699738548",
11+
"@nativescript/ios": "~9.0.0",
1212
"@nativescript/tailwind": "^2.1.0"
1313
}
1414
}

apps/demo-react/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
hooks
2+
node_modules
3+
platforms
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { NativeScriptConfig } from '@nativescript/core';
2+
3+
export default {
4+
id: 'org.nstudio.nstreamdown.demoreact',
5+
appResourcesPath: '../../tools/assets/App_Resources',
6+
android: {
7+
v8Flags: '--expose_gc',
8+
markingMode: 'none',
9+
codeCache: true,
10+
suppressCallJSMethodExceptions: false,
11+
},
12+
ios: {
13+
discardUncaughtJsExceptions: false,
14+
},
15+
appPath: 'src',
16+
cli: {
17+
packageManager: 'npm',
18+
},
19+
} as NativeScriptConfig;

apps/demo-react/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "demo-react",
3+
"main": "src/app.ts",
4+
"version": "1.0.0",
5+
"private": true,
6+
"dependencies": {
7+
"@nativescript/core": "file:../../node_modules/@nativescript/core",
8+
"@nstudio/nstreamdown": "file:../../packages/nstreamdown"
9+
},
10+
"devDependencies": {
11+
"@nativescript/android": "~9.0.0",
12+
"@nativescript/ios": "~9.0.0",
13+
"@nativescript/tailwind": "^2.1.0"
14+
}
15+
}

apps/demo-react/project.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "demo-react",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "apps/demo-react/src",
5+
"projectType": "application",
6+
"targets": {
7+
"build": {
8+
"executor": "@nativescript/nx:build",
9+
"options": {
10+
"noHmr": true,
11+
"production": true,
12+
"uglify": true,
13+
"release": true,
14+
"forDevice": true,
15+
"tsConfig": "apps/demo-react/tsconfig.json"
16+
},
17+
"dependsOn": [
18+
{
19+
"target": "build.all",
20+
"dependencies": true
21+
}
22+
]
23+
},
24+
"debug": {
25+
"executor": "@nativescript/nx:debug",
26+
"options": {
27+
"noHmr": true,
28+
"uglify": false,
29+
"release": false,
30+
"forDevice": false,
31+
"prepare": false
32+
}
33+
},
34+
"clean": {
35+
"executor": "@nativescript/nx:clean",
36+
"options": {}
37+
},
38+
"ios": {
39+
"executor": "@nativescript/nx:build",
40+
"options": {
41+
"platform": "ios",
42+
"noHmr": true
43+
}
44+
},
45+
"android": {
46+
"executor": "@nativescript/nx:build",
47+
"options": {
48+
"platform": "android",
49+
"noHmr": true
50+
}
51+
}
52+
}
53+
}

apps/demo-react/references.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference path="../../references.d.ts" />

apps/demo-react/src/app.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;

apps/demo-react/src/app.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import * as React from 'react';
2+
import { start, registerElement, NativeScriptProps, ViewAttributes } from 'react-nativescript';
3+
import { NativeCodeView } from '@nstudio/nstreamdown';
4+
import { App } from './components/App';
5+
6+
// In NativeScript, the app.ts file is the entry point to your application. You
7+
// can use this file to perform app-level initialization, but the primary
8+
// purpose of the file is to pass control to the app's first module.
9+
10+
// Controls react-nativescript log verbosity.
11+
// - true: all logs;
12+
// - false: only error logs.
13+
Object.defineProperty(global, '__DEV__', { value: false });
14+
15+
// To use NativeCodeView within JSX
16+
interface NativeCodeViewAttrs extends ViewAttributes {
17+
code: string;
18+
language: string;
19+
}
20+
declare global {
21+
module JSX {
22+
interface IntrinsicElements {
23+
nativeCodeView: NativeScriptProps<NativeCodeViewAttrs, NativeCodeView>;
24+
}
25+
}
26+
}
27+
28+
registerElement('nativeCodeView', () => <any>NativeCodeView);
29+
30+
start(React.createElement(App, {}, null));
31+
32+
// Do not place any code after the application has been started as it will not
33+
// be executed on iOS.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import * as React from "react";
2+
import { useState } from "react";
3+
import { FrameNavigationProp } from "react-nativescript-navigation";
4+
import { Home } from "./Home";
5+
import { StreamdownDemo } from "./StreamdownDemo";
6+
import { ChatDemo } from "./ChatDemo";
7+
8+
// Simple navigation state
9+
type Screen = 'home' | 'demo' | 'chat';
10+
11+
export const App = () => {
12+
const [currentScreen, setCurrentScreen] = useState<Screen>('home');
13+
14+
const navigate = (screen: Screen) => {
15+
setCurrentScreen(screen);
16+
};
17+
18+
const goBack = () => {
19+
setCurrentScreen('home');
20+
};
21+
22+
return (
23+
<frame>
24+
{currentScreen === 'home' && <Home onNavigate={navigate} />}
25+
{currentScreen === 'demo' && <StreamdownDemo onBack={goBack} />}
26+
{currentScreen === 'chat' && <ChatDemo onBack={goBack} />}
27+
</frame>
28+
);
29+
};

0 commit comments

Comments
 (0)