@idealyst/cli 1.0.61 → 1.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/templates/native/package.json +2 -1
- package/dist/templates/native/src/App-with-trpc-and-shared.tsx +11 -17
- package/dist/templates/native/src/App-with-trpc.tsx +11 -17
- package/dist/templates/native/src/App.tsx +1 -1
- package/dist/templates/shared/package.json +4 -1
- package/dist/templates/shared/src/navigation/AppRouter.tsx +25 -20
- package/dist/templates/shared/src/trpc/client.ts +12 -7
- package/dist/templates/web/src/App-with-trpc-and-shared.tsx +10 -16
- package/dist/templates/web/src/App-with-trpc.tsx +11 -17
- package/dist/templates/web/src/App.tsx +1 -1
- package/package.json +1 -1
- package/templates/native/package.json +2 -1
- package/templates/native/src/App-with-trpc-and-shared.tsx +1 -2
- package/templates/native/src/App-with-trpc.tsx +1 -2
- package/templates/native/src/App.tsx +1 -1
- package/templates/shared/package.json +2 -0
- package/templates/shared/src/navigation/AppRouter.tsx +25 -20
- package/templates/web/src/App-with-trpc-and-shared.tsx +1 -2
- package/templates/web/src/App-with-trpc.tsx +2 -3
- package/templates/web/src/App.tsx +1 -1
- package/dist/templates/native/src/navigation/AppRouter.tsx +0 -121
- package/dist/templates/web/src/navigation/AppRouter.tsx +0 -121
- package/dist/templates/web/src/navigation/AppRouterWithTrpc.tsx +0 -117
- package/templates/native/src/navigation/AppRouter.tsx +0 -121
- package/templates/web/src/navigation/AppRouter.tsx +0 -121
- package/templates/web/src/navigation/AppRouterWithTrpc.tsx +0 -117
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
-
import { httpBatchLink } from '@trpc/client';
|
|
4
3
|
import { NavigatorProvider } from '@idealyst/navigation';
|
|
5
|
-
import { trpc } from '
|
|
6
|
-
import { AppRouter } from '@{{workspaceScope}}/shared';
|
|
4
|
+
import { trpc, createTRPCClient, AppRouter } from '{{workspaceScope}}/shared';
|
|
7
5
|
|
|
8
|
-
// Create tRPC client
|
|
6
|
+
// Create tRPC client using shared factory
|
|
9
7
|
const queryClient = new QueryClient();
|
|
10
8
|
|
|
11
|
-
const trpcClient =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// };
|
|
21
|
-
// },
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
9
|
+
const trpcClient = createTRPCClient({
|
|
10
|
+
apiUrl: 'http://localhost:3000/trpc', // Update this to your API URL
|
|
11
|
+
// For device testing, you might need: 'http://192.168.1.xxx:3000/trpc'
|
|
12
|
+
// Optional: Add headers for authentication
|
|
13
|
+
// headers() {
|
|
14
|
+
// return {
|
|
15
|
+
// authorization: getAuthToken(),
|
|
16
|
+
// };
|
|
17
|
+
// },
|
|
24
18
|
});
|
|
25
19
|
|
|
26
20
|
function App() {
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
-
import { httpBatchLink } from '@trpc/client';
|
|
4
3
|
import { NavigatorProvider } from '@idealyst/navigation';
|
|
5
|
-
import { trpc } from '
|
|
6
|
-
import AppRouter from './navigation/AppRouter';
|
|
4
|
+
import { trpc, createTRPCClient, AppRouter } from '{{workspaceScope}}/shared';
|
|
7
5
|
|
|
8
|
-
// Create tRPC client
|
|
6
|
+
// Create tRPC client using shared factory
|
|
9
7
|
const queryClient = new QueryClient();
|
|
10
8
|
|
|
11
|
-
const trpcClient =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// };
|
|
21
|
-
// },
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
9
|
+
const trpcClient = createTRPCClient({
|
|
10
|
+
apiUrl: 'http://localhost:3000/trpc', // Update this to your API URL
|
|
11
|
+
// For device testing, you might need: 'http://192.168.1.xxx:3000/trpc'
|
|
12
|
+
// Optional: Add headers for authentication
|
|
13
|
+
// headers() {
|
|
14
|
+
// return {
|
|
15
|
+
// authorization: getAuthToken(),
|
|
16
|
+
// };
|
|
17
|
+
// },
|
|
24
18
|
});
|
|
25
19
|
|
|
26
20
|
function App() {
|
|
@@ -20,13 +20,15 @@
|
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@idealyst/components": "^1.0.21",
|
|
23
|
+
"@idealyst/navigation": "^1.0.21",
|
|
23
24
|
"@idealyst/theme": "^1.0.21",
|
|
24
25
|
"@tanstack/react-query": "^5.83.0",
|
|
25
26
|
"@trpc/client": "^11.5.1",
|
|
26
27
|
"@trpc/react-query": "^11.5.1",
|
|
27
28
|
"@trpc/server": "^11.5.1",
|
|
28
29
|
"react": "^19.1.0",
|
|
29
|
-
"react-native": "^0.80.1"
|
|
30
|
+
"react-native": "^0.80.1",
|
|
31
|
+
"{{workspaceScope}}/api": "*"
|
|
30
32
|
},
|
|
31
33
|
"peerDependenciesMeta": {
|
|
32
34
|
"react-native": {
|
|
@@ -35,6 +37,7 @@
|
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
39
|
"@idealyst/components": "^1.0.21",
|
|
40
|
+
"@idealyst/navigation": "^1.0.21",
|
|
38
41
|
"@idealyst/theme": "^1.0.21",
|
|
39
42
|
"@tanstack/react-query": "^5.83.0",
|
|
40
43
|
"@trpc/client": "^11.5.1",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { NavigatorParam } from '@idealyst/navigation';
|
|
3
3
|
import { Screen, Text, View, Icon } from '@idealyst/components';
|
|
4
4
|
import { HelloWorld } from '../components/HelloWorld';
|
|
5
5
|
|
|
@@ -51,24 +51,28 @@ const SettingsScreen = () => (
|
|
|
51
51
|
</Screen>
|
|
52
52
|
);
|
|
53
53
|
|
|
54
|
-
const AppRouter:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
layout:
|
|
58
|
-
type: "tab",
|
|
59
|
-
},
|
|
60
|
-
screenOptions: {
|
|
61
|
-
title: 'Home',
|
|
62
|
-
tabBarLabel: 'Home',
|
|
63
|
-
tabBarIcon: ({ focused, size }) => (
|
|
64
|
-
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
65
|
-
),
|
|
66
|
-
},
|
|
54
|
+
const AppRouter: NavigatorParam = {
|
|
55
|
+
type: 'navigator',
|
|
56
|
+
path: '/',
|
|
57
|
+
layout: 'tab',
|
|
67
58
|
routes: [
|
|
68
|
-
{
|
|
69
|
-
|
|
59
|
+
{
|
|
60
|
+
type: 'screen',
|
|
61
|
+
path: '/',
|
|
62
|
+
component: HomeScreen,
|
|
63
|
+
options: {
|
|
64
|
+
title: 'Home',
|
|
65
|
+
tabBarLabel: 'Home',
|
|
66
|
+
tabBarIcon: ({ focused, size }) => (
|
|
67
|
+
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
68
|
+
),
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: 'screen',
|
|
73
|
+
path: '/profile',
|
|
70
74
|
component: ProfileScreen,
|
|
71
|
-
|
|
75
|
+
options: {
|
|
72
76
|
title: 'Profile',
|
|
73
77
|
tabBarLabel: 'Profile',
|
|
74
78
|
tabBarIcon: ({ focused, size }) => (
|
|
@@ -76,10 +80,11 @@ const AppRouter: RouteParam = {
|
|
|
76
80
|
),
|
|
77
81
|
},
|
|
78
82
|
},
|
|
79
|
-
{
|
|
80
|
-
|
|
83
|
+
{
|
|
84
|
+
type: 'screen',
|
|
85
|
+
path: '/settings',
|
|
81
86
|
component: SettingsScreen,
|
|
82
|
-
|
|
87
|
+
options: {
|
|
83
88
|
title: 'Settings',
|
|
84
89
|
tabBarLabel: 'Settings',
|
|
85
90
|
tabBarIcon: ({ focused, size }) => (
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import type { AppRouter } from
|
|
1
|
+
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
|
|
2
|
+
import { createTRPCReact } from "@trpc/react-query";
|
|
3
|
+
import type { AppRouter } from "@{{workspaceScope}}/api";
|
|
4
4
|
|
|
5
5
|
// Create the tRPC React hooks with full type safety
|
|
6
|
-
export const trpc
|
|
6
|
+
export const trpc: ReturnType<typeof createTRPCReact<AppRouter>> =
|
|
7
|
+
createTRPCReact<AppRouter>();
|
|
7
8
|
|
|
8
9
|
// Configuration for tRPC client
|
|
9
10
|
export interface TRPCClientConfig {
|
|
@@ -12,7 +13,9 @@ export interface TRPCClientConfig {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
// Create tRPC client factory
|
|
15
|
-
export function createTRPCClient(
|
|
16
|
+
export function createTRPCClient(
|
|
17
|
+
config: TRPCClientConfig
|
|
18
|
+
): ReturnType<typeof trpc.createClient> {
|
|
16
19
|
return trpc.createClient({
|
|
17
20
|
links: [
|
|
18
21
|
httpBatchLink({
|
|
@@ -24,7 +27,9 @@ export function createTRPCClient(config: TRPCClientConfig) {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
// Create a vanilla client (for use outside of React components)
|
|
27
|
-
export function createVanillaTRPCClient(
|
|
30
|
+
export function createVanillaTRPCClient(
|
|
31
|
+
config: TRPCClientConfig
|
|
32
|
+
): ReturnType<typeof createTRPCProxyClient<AppRouter>> {
|
|
28
33
|
return createTRPCProxyClient<AppRouter>({
|
|
29
34
|
links: [
|
|
30
35
|
httpBatchLink({
|
|
@@ -36,4 +41,4 @@ export function createVanillaTRPCClient(config: TRPCClientConfig) {
|
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
// Export types
|
|
39
|
-
export type { AppRouter } from
|
|
44
|
+
export type { AppRouter } from "@{{workspaceScope}}/api";
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
-
import { httpBatchLink } from '@trpc/client';
|
|
4
3
|
import { BrowserRouter } from 'react-router-dom';
|
|
5
4
|
import { NavigatorProvider } from '@idealyst/navigation';
|
|
6
|
-
import { trpc } from '
|
|
7
|
-
import { AppRouter } from '@{{workspaceScope}}/shared';
|
|
5
|
+
import { trpc, createTRPCClient, AppRouter } from '{{workspaceScope}}/shared';
|
|
8
6
|
|
|
9
|
-
// Create tRPC client
|
|
7
|
+
// Create tRPC client using shared factory
|
|
10
8
|
const queryClient = new QueryClient();
|
|
11
9
|
|
|
12
|
-
const trpcClient =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// };
|
|
21
|
-
// },
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
10
|
+
const trpcClient = createTRPCClient({
|
|
11
|
+
apiUrl: 'http://localhost:3000/trpc', // Update this to match your API URL
|
|
12
|
+
// Optional: Add headers for authentication
|
|
13
|
+
// headers() {
|
|
14
|
+
// return {
|
|
15
|
+
// authorization: getAuthToken(),
|
|
16
|
+
// };
|
|
17
|
+
// },
|
|
24
18
|
});
|
|
25
19
|
|
|
26
20
|
function App() {
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
-
import { httpBatchLink } from '@trpc/client';
|
|
4
3
|
import { BrowserRouter } from 'react-router-dom';
|
|
5
4
|
import { NavigatorProvider } from '@idealyst/navigation';
|
|
6
|
-
import { trpc } from '
|
|
7
|
-
import AppRouterWithTrpc from './navigation/AppRouterWithTrpc';
|
|
5
|
+
import { trpc, createTRPCClient, AppRouter } from '{{workspaceScope}}/shared';
|
|
8
6
|
|
|
9
|
-
// Create tRPC client
|
|
7
|
+
// Create tRPC client using shared factory
|
|
10
8
|
const queryClient = new QueryClient();
|
|
11
9
|
|
|
12
|
-
const trpcClient =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// };
|
|
21
|
-
// },
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
10
|
+
const trpcClient = createTRPCClient({
|
|
11
|
+
apiUrl: 'http://localhost:3000/trpc', // Update this to match your API URL
|
|
12
|
+
// Optional: Add headers for authentication
|
|
13
|
+
// headers() {
|
|
14
|
+
// return {
|
|
15
|
+
// authorization: getAuthToken(),
|
|
16
|
+
// };
|
|
17
|
+
// },
|
|
24
18
|
});
|
|
25
19
|
|
|
26
20
|
function App() {
|
|
@@ -28,7 +22,7 @@ function App() {
|
|
|
28
22
|
<trpc.Provider client={trpcClient} queryClient={queryClient}>
|
|
29
23
|
<QueryClientProvider client={queryClient}>
|
|
30
24
|
<BrowserRouter>
|
|
31
|
-
<NavigatorProvider route={
|
|
25
|
+
<NavigatorProvider route={AppRouter} />
|
|
32
26
|
</BrowserRouter>
|
|
33
27
|
</QueryClientProvider>
|
|
34
28
|
</trpc.Provider>
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
3
|
import { NavigatorProvider } from '@idealyst/navigation';
|
|
4
|
-
import { trpc, createTRPCClient } from '
|
|
5
|
-
import { AppRouter } from '@{{workspaceScope}}/shared';
|
|
4
|
+
import { trpc, createTRPCClient, AppRouter } from '{{workspaceScope}}/shared';
|
|
6
5
|
|
|
7
6
|
// Create tRPC client using shared factory
|
|
8
7
|
const queryClient = new QueryClient();
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
3
|
import { NavigatorProvider } from '@idealyst/navigation';
|
|
4
|
-
import { trpc, createTRPCClient } from '
|
|
5
|
-
import AppRouter from './navigation/AppRouter';
|
|
4
|
+
import { trpc, createTRPCClient, AppRouter } from '{{workspaceScope}}/shared';
|
|
6
5
|
|
|
7
6
|
// Create tRPC client using shared factory
|
|
8
7
|
const queryClient = new QueryClient();
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@idealyst/components": "^1.0.21",
|
|
23
|
+
"@idealyst/navigation": "^1.0.21",
|
|
23
24
|
"@idealyst/theme": "^1.0.21",
|
|
24
25
|
"@tanstack/react-query": "^5.83.0",
|
|
25
26
|
"@trpc/client": "^11.5.1",
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@idealyst/components": "^1.0.21",
|
|
40
|
+
"@idealyst/navigation": "^1.0.21",
|
|
39
41
|
"@idealyst/theme": "^1.0.21",
|
|
40
42
|
"@tanstack/react-query": "^5.83.0",
|
|
41
43
|
"@trpc/client": "^11.5.1",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { NavigatorParam } from '@idealyst/navigation';
|
|
3
3
|
import { Screen, Text, View, Icon } from '@idealyst/components';
|
|
4
4
|
import { HelloWorld } from '../components/HelloWorld';
|
|
5
5
|
|
|
@@ -51,24 +51,28 @@ const SettingsScreen = () => (
|
|
|
51
51
|
</Screen>
|
|
52
52
|
);
|
|
53
53
|
|
|
54
|
-
const AppRouter:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
layout:
|
|
58
|
-
type: "tab",
|
|
59
|
-
},
|
|
60
|
-
screenOptions: {
|
|
61
|
-
title: 'Home',
|
|
62
|
-
tabBarLabel: 'Home',
|
|
63
|
-
tabBarIcon: ({ focused, size }) => (
|
|
64
|
-
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
65
|
-
),
|
|
66
|
-
},
|
|
54
|
+
const AppRouter: NavigatorParam = {
|
|
55
|
+
type: 'navigator',
|
|
56
|
+
path: '/',
|
|
57
|
+
layout: 'tab',
|
|
67
58
|
routes: [
|
|
68
|
-
{
|
|
69
|
-
|
|
59
|
+
{
|
|
60
|
+
type: 'screen',
|
|
61
|
+
path: '/',
|
|
62
|
+
component: HomeScreen,
|
|
63
|
+
options: {
|
|
64
|
+
title: 'Home',
|
|
65
|
+
tabBarLabel: 'Home',
|
|
66
|
+
tabBarIcon: ({ focused, size }) => (
|
|
67
|
+
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
68
|
+
),
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: 'screen',
|
|
73
|
+
path: '/profile',
|
|
70
74
|
component: ProfileScreen,
|
|
71
|
-
|
|
75
|
+
options: {
|
|
72
76
|
title: 'Profile',
|
|
73
77
|
tabBarLabel: 'Profile',
|
|
74
78
|
tabBarIcon: ({ focused, size }) => (
|
|
@@ -76,10 +80,11 @@ const AppRouter: RouteParam = {
|
|
|
76
80
|
),
|
|
77
81
|
},
|
|
78
82
|
},
|
|
79
|
-
{
|
|
80
|
-
|
|
83
|
+
{
|
|
84
|
+
type: 'screen',
|
|
85
|
+
path: '/settings',
|
|
81
86
|
component: SettingsScreen,
|
|
82
|
-
|
|
87
|
+
options: {
|
|
83
88
|
title: 'Settings',
|
|
84
89
|
tabBarLabel: 'Settings',
|
|
85
90
|
tabBarIcon: ({ focused, size }) => (
|
|
@@ -2,8 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
3
|
import { BrowserRouter } from 'react-router-dom';
|
|
4
4
|
import { NavigatorProvider } from '@idealyst/navigation';
|
|
5
|
-
import { trpc, createTRPCClient } from '
|
|
6
|
-
import { AppRouter } from '@{{workspaceScope}}/shared';
|
|
5
|
+
import { trpc, createTRPCClient, AppRouter } from '{{workspaceScope}}/shared';
|
|
7
6
|
|
|
8
7
|
// Create tRPC client using shared factory
|
|
9
8
|
const queryClient = new QueryClient();
|
|
@@ -2,8 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
3
|
import { BrowserRouter } from 'react-router-dom';
|
|
4
4
|
import { NavigatorProvider } from '@idealyst/navigation';
|
|
5
|
-
import { trpc, createTRPCClient } from '
|
|
6
|
-
import AppRouterWithTrpc from './navigation/AppRouterWithTrpc';
|
|
5
|
+
import { trpc, createTRPCClient, AppRouter } from '{{workspaceScope}}/shared';
|
|
7
6
|
|
|
8
7
|
// Create tRPC client using shared factory
|
|
9
8
|
const queryClient = new QueryClient();
|
|
@@ -23,7 +22,7 @@ function App() {
|
|
|
23
22
|
<trpc.Provider client={trpcClient} queryClient={queryClient}>
|
|
24
23
|
<QueryClientProvider client={queryClient}>
|
|
25
24
|
<BrowserRouter>
|
|
26
|
-
<NavigatorProvider route={
|
|
25
|
+
<NavigatorProvider route={AppRouter} />
|
|
27
26
|
</BrowserRouter>
|
|
28
27
|
</QueryClientProvider>
|
|
29
28
|
</trpc.Provider>
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { RouteParam } from '@idealyst/navigation';
|
|
3
|
-
import { Screen, Text, View, Icon, Button } from '@idealyst/components';
|
|
4
|
-
|
|
5
|
-
// Simple API test component for native-only projects
|
|
6
|
-
const ApiTest = () => {
|
|
7
|
-
const [result, setResult] = React.useState<string>('Tap to test API');
|
|
8
|
-
|
|
9
|
-
const testApi = async () => {
|
|
10
|
-
try {
|
|
11
|
-
setResult('Testing...');
|
|
12
|
-
// Simple fetch test - replace with actual API endpoint
|
|
13
|
-
const response = await fetch('http://localhost:3000/api/test');
|
|
14
|
-
if (response.ok) {
|
|
15
|
-
setResult('✅ API connection successful!');
|
|
16
|
-
} else {
|
|
17
|
-
setResult('❌ API connection failed');
|
|
18
|
-
}
|
|
19
|
-
} catch (error) {
|
|
20
|
-
setResult('❌ API connection failed');
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<View spacing="sm">
|
|
26
|
-
<Text size="small">{result}</Text>
|
|
27
|
-
<Button variant="outlined" onPress={testApi} size="small">
|
|
28
|
-
Test API
|
|
29
|
-
</Button>
|
|
30
|
-
</View>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const HomeScreen = () => (
|
|
35
|
-
<Screen>
|
|
36
|
-
<View spacing="lg">
|
|
37
|
-
<Text size="xlarge" weight="bold">Home</Text>
|
|
38
|
-
<Text size="medium">Welcome to {{appName}}!</Text>
|
|
39
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
40
|
-
<Text size="small">
|
|
41
|
-
This app uses tab navigation. Navigate between tabs using the bottom bar.
|
|
42
|
-
</Text>
|
|
43
|
-
</View>
|
|
44
|
-
|
|
45
|
-
{/* API Testing Component */}
|
|
46
|
-
<View spacing="md" style={{ marginTop: 32 }}>
|
|
47
|
-
<Text size="medium" weight="semibold">API Test</Text>
|
|
48
|
-
<ApiTest />
|
|
49
|
-
</View>
|
|
50
|
-
</View>
|
|
51
|
-
</Screen>
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const ProfileScreen = () => (
|
|
55
|
-
<Screen>
|
|
56
|
-
<View spacing="lg">
|
|
57
|
-
<Text size="xlarge" weight="bold">Profile</Text>
|
|
58
|
-
<Text size="medium">User profile and account settings</Text>
|
|
59
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
60
|
-
<Text size="small">
|
|
61
|
-
Manage your account details and preferences here.
|
|
62
|
-
</Text>
|
|
63
|
-
</View>
|
|
64
|
-
</View>
|
|
65
|
-
</Screen>
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const SettingsScreen = () => (
|
|
69
|
-
<Screen>
|
|
70
|
-
<View spacing="lg">
|
|
71
|
-
<Text size="xlarge" weight="bold">Settings</Text>
|
|
72
|
-
<Text size="medium">App configuration and preferences</Text>
|
|
73
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
74
|
-
<Text size="small">
|
|
75
|
-
Customize your app experience with various settings and options.
|
|
76
|
-
</Text>
|
|
77
|
-
</View>
|
|
78
|
-
</View>
|
|
79
|
-
</Screen>
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
const AppRouter: RouteParam = {
|
|
83
|
-
path: "/",
|
|
84
|
-
component: HomeScreen,
|
|
85
|
-
layout: {
|
|
86
|
-
type: "tab",
|
|
87
|
-
},
|
|
88
|
-
screenOptions: {
|
|
89
|
-
title: 'Home',
|
|
90
|
-
tabBarLabel: 'Home',
|
|
91
|
-
tabBarIcon: ({ focused, size }) => (
|
|
92
|
-
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
93
|
-
),
|
|
94
|
-
},
|
|
95
|
-
routes: [
|
|
96
|
-
{
|
|
97
|
-
path: "profile",
|
|
98
|
-
component: ProfileScreen,
|
|
99
|
-
screenOptions: {
|
|
100
|
-
title: 'Profile',
|
|
101
|
-
tabBarLabel: 'Profile',
|
|
102
|
-
tabBarIcon: ({ focused, size }) => (
|
|
103
|
-
<Icon name="account" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
104
|
-
),
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
path: "settings",
|
|
109
|
-
component: SettingsScreen,
|
|
110
|
-
screenOptions: {
|
|
111
|
-
title: 'Settings',
|
|
112
|
-
tabBarLabel: 'Settings',
|
|
113
|
-
tabBarIcon: ({ focused, size }) => (
|
|
114
|
-
<Icon name="cog" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
115
|
-
),
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export default AppRouter;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { RouteParam } from '@idealyst/navigation';
|
|
3
|
-
import { Screen, Text, View, Icon } from '@idealyst/components';
|
|
4
|
-
|
|
5
|
-
// Simple API test component for web-only projects
|
|
6
|
-
const ApiTest = () => {
|
|
7
|
-
const [result, setResult] = React.useState<string>('Click to test API');
|
|
8
|
-
|
|
9
|
-
const testApi = async () => {
|
|
10
|
-
try {
|
|
11
|
-
setResult('Testing...');
|
|
12
|
-
// Simple fetch test - replace with actual API endpoint
|
|
13
|
-
const response = await fetch('/api/test');
|
|
14
|
-
if (response.ok) {
|
|
15
|
-
setResult('✅ API connection successful!');
|
|
16
|
-
} else {
|
|
17
|
-
setResult('❌ API connection failed');
|
|
18
|
-
}
|
|
19
|
-
} catch (error) {
|
|
20
|
-
setResult('❌ API connection failed');
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<View spacing="sm">
|
|
26
|
-
<Text size="small">{result}</Text>
|
|
27
|
-
<button onClick={testApi} style={{ padding: '8px 16px', marginTop: '8px' }}>
|
|
28
|
-
Test API
|
|
29
|
-
</button>
|
|
30
|
-
</View>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const HomeScreen = () => (
|
|
35
|
-
<Screen>
|
|
36
|
-
<View spacing="lg">
|
|
37
|
-
<Text size="xlarge" weight="bold">Home</Text>
|
|
38
|
-
<Text size="medium">Welcome to your {{projectName}} app!</Text>
|
|
39
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
40
|
-
<Text size="small">
|
|
41
|
-
This app uses tab navigation. Navigate between tabs using the top bar or menu.
|
|
42
|
-
</Text>
|
|
43
|
-
</View>
|
|
44
|
-
|
|
45
|
-
{/* API Testing Component */}
|
|
46
|
-
<View spacing="md" style={{ marginTop: 32 }}>
|
|
47
|
-
<Text size="medium" weight="semibold">API Test</Text>
|
|
48
|
-
<ApiTest />
|
|
49
|
-
</View>
|
|
50
|
-
</View>
|
|
51
|
-
</Screen>
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const ProfileScreen = () => (
|
|
55
|
-
<Screen>
|
|
56
|
-
<View spacing="lg">
|
|
57
|
-
<Text size="xlarge" weight="bold">Profile</Text>
|
|
58
|
-
<Text size="medium">User profile and account settings</Text>
|
|
59
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
60
|
-
<Text size="small">
|
|
61
|
-
Manage your account details and preferences here.
|
|
62
|
-
</Text>
|
|
63
|
-
</View>
|
|
64
|
-
</View>
|
|
65
|
-
</Screen>
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const SettingsScreen = () => (
|
|
69
|
-
<Screen>
|
|
70
|
-
<View spacing="lg">
|
|
71
|
-
<Text size="xlarge" weight="bold">Settings</Text>
|
|
72
|
-
<Text size="medium">App configuration and preferences</Text>
|
|
73
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
74
|
-
<Text size="small">
|
|
75
|
-
Customize your app experience with various settings and options.
|
|
76
|
-
</Text>
|
|
77
|
-
</View>
|
|
78
|
-
</View>
|
|
79
|
-
</Screen>
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
const AppRouter: RouteParam = {
|
|
83
|
-
path: "/",
|
|
84
|
-
component: HomeScreen,
|
|
85
|
-
layout: {
|
|
86
|
-
type: "tab",
|
|
87
|
-
},
|
|
88
|
-
screenOptions: {
|
|
89
|
-
title: 'Home',
|
|
90
|
-
tabBarLabel: 'Home',
|
|
91
|
-
tabBarIcon: ({ focused, size }) => (
|
|
92
|
-
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
93
|
-
),
|
|
94
|
-
},
|
|
95
|
-
routes: [
|
|
96
|
-
{
|
|
97
|
-
path: "profile",
|
|
98
|
-
component: ProfileScreen,
|
|
99
|
-
screenOptions: {
|
|
100
|
-
title: 'Profile',
|
|
101
|
-
tabBarLabel: 'Profile',
|
|
102
|
-
tabBarIcon: ({ focused, size }) => (
|
|
103
|
-
<Icon name="account" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
104
|
-
),
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
path: "settings",
|
|
109
|
-
component: SettingsScreen,
|
|
110
|
-
screenOptions: {
|
|
111
|
-
title: 'Settings',
|
|
112
|
-
tabBarLabel: 'Settings',
|
|
113
|
-
tabBarIcon: ({ focused, size }) => (
|
|
114
|
-
<Icon name="cog" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
115
|
-
),
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export default AppRouter;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { RouteParam } from '@idealyst/navigation';
|
|
3
|
-
import { Screen, Text, View, Icon, Button } from '@idealyst/components';
|
|
4
|
-
import { trpc } from '../utils/trpc';
|
|
5
|
-
|
|
6
|
-
const HomeScreen = () => {
|
|
7
|
-
// Example tRPC usage
|
|
8
|
-
const [name, setName] = React.useState('{{projectName}}');
|
|
9
|
-
const { data, isLoading, error, refetch } = trpc.hello.useQuery({ name });
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<Screen>
|
|
13
|
-
<View spacing="lg">
|
|
14
|
-
<Text size="xlarge" weight="bold">Home</Text>
|
|
15
|
-
<Text size="medium">Welcome to your {{projectName}} app!</Text>
|
|
16
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
17
|
-
<Text size="small">
|
|
18
|
-
This app uses tab navigation with tRPC integration. Navigate between tabs using the top bar or menu.
|
|
19
|
-
</Text>
|
|
20
|
-
|
|
21
|
-
{/* tRPC API Test */}
|
|
22
|
-
<View spacing="sm" style={{ marginTop: 20 }}>
|
|
23
|
-
<Text size="medium" weight="semibold">API Test (tRPC):</Text>
|
|
24
|
-
<View spacing="xs">
|
|
25
|
-
<input
|
|
26
|
-
type="text"
|
|
27
|
-
value={name}
|
|
28
|
-
onChange={(e) => setName(e.target.value)}
|
|
29
|
-
placeholder="Enter your name"
|
|
30
|
-
style={{ padding: '8px', border: '1px solid #ccc', borderRadius: '4px' }}
|
|
31
|
-
/>
|
|
32
|
-
<Button variant="outlined" onPress={() => refetch()} size="small">
|
|
33
|
-
Test tRPC API
|
|
34
|
-
</Button>
|
|
35
|
-
</View>
|
|
36
|
-
|
|
37
|
-
{/* Results */}
|
|
38
|
-
<View style={{ marginTop: 12 }}>
|
|
39
|
-
{isLoading && <Text size="small">Loading...</Text>}
|
|
40
|
-
{error && <Text size="small" color="error">Error: {error.message}</Text>}
|
|
41
|
-
{data && <Text size="small">✅ {data.greeting}</Text>}
|
|
42
|
-
</View>
|
|
43
|
-
</View>
|
|
44
|
-
</View>
|
|
45
|
-
</View>
|
|
46
|
-
</Screen>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const ProfileScreen = () => (
|
|
51
|
-
<Screen>
|
|
52
|
-
<View spacing="lg">
|
|
53
|
-
<Text size="xlarge" weight="bold">Profile</Text>
|
|
54
|
-
<Text size="medium">User profile and account settings</Text>
|
|
55
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
56
|
-
<Text size="small">
|
|
57
|
-
Manage your account details and preferences here.
|
|
58
|
-
</Text>
|
|
59
|
-
</View>
|
|
60
|
-
</View>
|
|
61
|
-
</Screen>
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const SettingsScreen = () => (
|
|
65
|
-
<Screen>
|
|
66
|
-
<View spacing="lg">
|
|
67
|
-
<Text size="xlarge" weight="bold">Settings</Text>
|
|
68
|
-
<Text size="medium">App configuration and preferences</Text>
|
|
69
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
70
|
-
<Text size="small">
|
|
71
|
-
Customize your app experience with various settings and options.
|
|
72
|
-
</Text>
|
|
73
|
-
</View>
|
|
74
|
-
</View>
|
|
75
|
-
</Screen>
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const AppRouterWithTrpc: RouteParam = {
|
|
79
|
-
path: "/",
|
|
80
|
-
component: HomeScreen,
|
|
81
|
-
layout: {
|
|
82
|
-
type: "tab",
|
|
83
|
-
},
|
|
84
|
-
screenOptions: {
|
|
85
|
-
title: 'Home',
|
|
86
|
-
tabBarLabel: 'Home',
|
|
87
|
-
tabBarIcon: ({ focused, size }) => (
|
|
88
|
-
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
89
|
-
),
|
|
90
|
-
},
|
|
91
|
-
routes: [
|
|
92
|
-
{
|
|
93
|
-
path: "profile",
|
|
94
|
-
component: ProfileScreen,
|
|
95
|
-
screenOptions: {
|
|
96
|
-
title: 'Profile',
|
|
97
|
-
tabBarLabel: 'Profile',
|
|
98
|
-
tabBarIcon: ({ focused, size }) => (
|
|
99
|
-
<Icon name="account" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
100
|
-
),
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
path: "settings",
|
|
105
|
-
component: SettingsScreen,
|
|
106
|
-
screenOptions: {
|
|
107
|
-
title: 'Settings',
|
|
108
|
-
tabBarLabel: 'Settings',
|
|
109
|
-
tabBarIcon: ({ focused, size }) => (
|
|
110
|
-
<Icon name="cog" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
111
|
-
),
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
export default AppRouterWithTrpc;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { RouteParam } from '@idealyst/navigation';
|
|
3
|
-
import { Screen, Text, View, Icon, Button } from '@idealyst/components';
|
|
4
|
-
|
|
5
|
-
// Simple API test component for native-only projects
|
|
6
|
-
const ApiTest = () => {
|
|
7
|
-
const [result, setResult] = React.useState<string>('Tap to test API');
|
|
8
|
-
|
|
9
|
-
const testApi = async () => {
|
|
10
|
-
try {
|
|
11
|
-
setResult('Testing...');
|
|
12
|
-
// Simple fetch test - replace with actual API endpoint
|
|
13
|
-
const response = await fetch('http://localhost:3000/api/test');
|
|
14
|
-
if (response.ok) {
|
|
15
|
-
setResult('✅ API connection successful!');
|
|
16
|
-
} else {
|
|
17
|
-
setResult('❌ API connection failed');
|
|
18
|
-
}
|
|
19
|
-
} catch (error) {
|
|
20
|
-
setResult('❌ API connection failed');
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<View spacing="sm">
|
|
26
|
-
<Text size="small">{result}</Text>
|
|
27
|
-
<Button variant="outlined" onPress={testApi} size="small">
|
|
28
|
-
Test API
|
|
29
|
-
</Button>
|
|
30
|
-
</View>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const HomeScreen = () => (
|
|
35
|
-
<Screen>
|
|
36
|
-
<View spacing="lg">
|
|
37
|
-
<Text size="xlarge" weight="bold">Home</Text>
|
|
38
|
-
<Text size="medium">Welcome to {{appName}}!</Text>
|
|
39
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
40
|
-
<Text size="small">
|
|
41
|
-
This app uses tab navigation. Navigate between tabs using the bottom bar.
|
|
42
|
-
</Text>
|
|
43
|
-
</View>
|
|
44
|
-
|
|
45
|
-
{/* API Testing Component */}
|
|
46
|
-
<View spacing="md" style={{ marginTop: 32 }}>
|
|
47
|
-
<Text size="medium" weight="semibold">API Test</Text>
|
|
48
|
-
<ApiTest />
|
|
49
|
-
</View>
|
|
50
|
-
</View>
|
|
51
|
-
</Screen>
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const ProfileScreen = () => (
|
|
55
|
-
<Screen>
|
|
56
|
-
<View spacing="lg">
|
|
57
|
-
<Text size="xlarge" weight="bold">Profile</Text>
|
|
58
|
-
<Text size="medium">User profile and account settings</Text>
|
|
59
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
60
|
-
<Text size="small">
|
|
61
|
-
Manage your account details and preferences here.
|
|
62
|
-
</Text>
|
|
63
|
-
</View>
|
|
64
|
-
</View>
|
|
65
|
-
</Screen>
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const SettingsScreen = () => (
|
|
69
|
-
<Screen>
|
|
70
|
-
<View spacing="lg">
|
|
71
|
-
<Text size="xlarge" weight="bold">Settings</Text>
|
|
72
|
-
<Text size="medium">App configuration and preferences</Text>
|
|
73
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
74
|
-
<Text size="small">
|
|
75
|
-
Customize your app experience with various settings and options.
|
|
76
|
-
</Text>
|
|
77
|
-
</View>
|
|
78
|
-
</View>
|
|
79
|
-
</Screen>
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
const AppRouter: RouteParam = {
|
|
83
|
-
path: "/",
|
|
84
|
-
component: HomeScreen,
|
|
85
|
-
layout: {
|
|
86
|
-
type: "tab",
|
|
87
|
-
},
|
|
88
|
-
screenOptions: {
|
|
89
|
-
title: 'Home',
|
|
90
|
-
tabBarLabel: 'Home',
|
|
91
|
-
tabBarIcon: ({ focused, size }) => (
|
|
92
|
-
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
93
|
-
),
|
|
94
|
-
},
|
|
95
|
-
routes: [
|
|
96
|
-
{
|
|
97
|
-
path: "profile",
|
|
98
|
-
component: ProfileScreen,
|
|
99
|
-
screenOptions: {
|
|
100
|
-
title: 'Profile',
|
|
101
|
-
tabBarLabel: 'Profile',
|
|
102
|
-
tabBarIcon: ({ focused, size }) => (
|
|
103
|
-
<Icon name="account" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
104
|
-
),
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
path: "settings",
|
|
109
|
-
component: SettingsScreen,
|
|
110
|
-
screenOptions: {
|
|
111
|
-
title: 'Settings',
|
|
112
|
-
tabBarLabel: 'Settings',
|
|
113
|
-
tabBarIcon: ({ focused, size }) => (
|
|
114
|
-
<Icon name="cog" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
115
|
-
),
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export default AppRouter;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { RouteParam } from '@idealyst/navigation';
|
|
3
|
-
import { Screen, Text, View, Icon } from '@idealyst/components';
|
|
4
|
-
|
|
5
|
-
// Simple API test component for web-only projects
|
|
6
|
-
const ApiTest = () => {
|
|
7
|
-
const [result, setResult] = React.useState<string>('Click to test API');
|
|
8
|
-
|
|
9
|
-
const testApi = async () => {
|
|
10
|
-
try {
|
|
11
|
-
setResult('Testing...');
|
|
12
|
-
// Simple fetch test - replace with actual API endpoint
|
|
13
|
-
const response = await fetch('/api/test');
|
|
14
|
-
if (response.ok) {
|
|
15
|
-
setResult('✅ API connection successful!');
|
|
16
|
-
} else {
|
|
17
|
-
setResult('❌ API connection failed');
|
|
18
|
-
}
|
|
19
|
-
} catch (error) {
|
|
20
|
-
setResult('❌ API connection failed');
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<View spacing="sm">
|
|
26
|
-
<Text size="small">{result}</Text>
|
|
27
|
-
<button onClick={testApi} style={{ padding: '8px 16px', marginTop: '8px' }}>
|
|
28
|
-
Test API
|
|
29
|
-
</button>
|
|
30
|
-
</View>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const HomeScreen = () => (
|
|
35
|
-
<Screen>
|
|
36
|
-
<View spacing="lg">
|
|
37
|
-
<Text size="xlarge" weight="bold">Home</Text>
|
|
38
|
-
<Text size="medium">Welcome to your {{projectName}} app!</Text>
|
|
39
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
40
|
-
<Text size="small">
|
|
41
|
-
This app uses tab navigation. Navigate between tabs using the top bar or menu.
|
|
42
|
-
</Text>
|
|
43
|
-
</View>
|
|
44
|
-
|
|
45
|
-
{/* API Testing Component */}
|
|
46
|
-
<View spacing="md" style={{ marginTop: 32 }}>
|
|
47
|
-
<Text size="medium" weight="semibold">API Test</Text>
|
|
48
|
-
<ApiTest />
|
|
49
|
-
</View>
|
|
50
|
-
</View>
|
|
51
|
-
</Screen>
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const ProfileScreen = () => (
|
|
55
|
-
<Screen>
|
|
56
|
-
<View spacing="lg">
|
|
57
|
-
<Text size="xlarge" weight="bold">Profile</Text>
|
|
58
|
-
<Text size="medium">User profile and account settings</Text>
|
|
59
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
60
|
-
<Text size="small">
|
|
61
|
-
Manage your account details and preferences here.
|
|
62
|
-
</Text>
|
|
63
|
-
</View>
|
|
64
|
-
</View>
|
|
65
|
-
</Screen>
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const SettingsScreen = () => (
|
|
69
|
-
<Screen>
|
|
70
|
-
<View spacing="lg">
|
|
71
|
-
<Text size="xlarge" weight="bold">Settings</Text>
|
|
72
|
-
<Text size="medium">App configuration and preferences</Text>
|
|
73
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
74
|
-
<Text size="small">
|
|
75
|
-
Customize your app experience with various settings and options.
|
|
76
|
-
</Text>
|
|
77
|
-
</View>
|
|
78
|
-
</View>
|
|
79
|
-
</Screen>
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
const AppRouter: RouteParam = {
|
|
83
|
-
path: "/",
|
|
84
|
-
component: HomeScreen,
|
|
85
|
-
layout: {
|
|
86
|
-
type: "tab",
|
|
87
|
-
},
|
|
88
|
-
screenOptions: {
|
|
89
|
-
title: 'Home',
|
|
90
|
-
tabBarLabel: 'Home',
|
|
91
|
-
tabBarIcon: ({ focused, size }) => (
|
|
92
|
-
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
93
|
-
),
|
|
94
|
-
},
|
|
95
|
-
routes: [
|
|
96
|
-
{
|
|
97
|
-
path: "profile",
|
|
98
|
-
component: ProfileScreen,
|
|
99
|
-
screenOptions: {
|
|
100
|
-
title: 'Profile',
|
|
101
|
-
tabBarLabel: 'Profile',
|
|
102
|
-
tabBarIcon: ({ focused, size }) => (
|
|
103
|
-
<Icon name="account" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
104
|
-
),
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
path: "settings",
|
|
109
|
-
component: SettingsScreen,
|
|
110
|
-
screenOptions: {
|
|
111
|
-
title: 'Settings',
|
|
112
|
-
tabBarLabel: 'Settings',
|
|
113
|
-
tabBarIcon: ({ focused, size }) => (
|
|
114
|
-
<Icon name="cog" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
115
|
-
),
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export default AppRouter;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { RouteParam } from '@idealyst/navigation';
|
|
3
|
-
import { Screen, Text, View, Icon, Button } from '@idealyst/components';
|
|
4
|
-
import { trpc } from '../utils/trpc';
|
|
5
|
-
|
|
6
|
-
const HomeScreen = () => {
|
|
7
|
-
// Example tRPC usage
|
|
8
|
-
const [name, setName] = React.useState('{{projectName}}');
|
|
9
|
-
const { data, isLoading, error, refetch } = trpc.hello.useQuery({ name });
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<Screen>
|
|
13
|
-
<View spacing="lg">
|
|
14
|
-
<Text size="xlarge" weight="bold">Home</Text>
|
|
15
|
-
<Text size="medium">Welcome to your {{projectName}} app!</Text>
|
|
16
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
17
|
-
<Text size="small">
|
|
18
|
-
This app uses tab navigation with tRPC integration. Navigate between tabs using the top bar or menu.
|
|
19
|
-
</Text>
|
|
20
|
-
|
|
21
|
-
{/* tRPC API Test */}
|
|
22
|
-
<View spacing="sm" style={{ marginTop: 20 }}>
|
|
23
|
-
<Text size="medium" weight="semibold">API Test (tRPC):</Text>
|
|
24
|
-
<View spacing="xs">
|
|
25
|
-
<input
|
|
26
|
-
type="text"
|
|
27
|
-
value={name}
|
|
28
|
-
onChange={(e) => setName(e.target.value)}
|
|
29
|
-
placeholder="Enter your name"
|
|
30
|
-
style={{ padding: '8px', border: '1px solid #ccc', borderRadius: '4px' }}
|
|
31
|
-
/>
|
|
32
|
-
<Button variant="outlined" onPress={() => refetch()} size="small">
|
|
33
|
-
Test tRPC API
|
|
34
|
-
</Button>
|
|
35
|
-
</View>
|
|
36
|
-
|
|
37
|
-
{/* Results */}
|
|
38
|
-
<View style={{ marginTop: 12 }}>
|
|
39
|
-
{isLoading && <Text size="small">Loading...</Text>}
|
|
40
|
-
{error && <Text size="small" color="error">Error: {error.message}</Text>}
|
|
41
|
-
{data && <Text size="small">✅ {data.greeting}</Text>}
|
|
42
|
-
</View>
|
|
43
|
-
</View>
|
|
44
|
-
</View>
|
|
45
|
-
</View>
|
|
46
|
-
</Screen>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const ProfileScreen = () => (
|
|
51
|
-
<Screen>
|
|
52
|
-
<View spacing="lg">
|
|
53
|
-
<Text size="xlarge" weight="bold">Profile</Text>
|
|
54
|
-
<Text size="medium">User profile and account settings</Text>
|
|
55
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
56
|
-
<Text size="small">
|
|
57
|
-
Manage your account details and preferences here.
|
|
58
|
-
</Text>
|
|
59
|
-
</View>
|
|
60
|
-
</View>
|
|
61
|
-
</Screen>
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const SettingsScreen = () => (
|
|
65
|
-
<Screen>
|
|
66
|
-
<View spacing="lg">
|
|
67
|
-
<Text size="xlarge" weight="bold">Settings</Text>
|
|
68
|
-
<Text size="medium">App configuration and preferences</Text>
|
|
69
|
-
<View spacing="md" style={{ marginTop: 24 }}>
|
|
70
|
-
<Text size="small">
|
|
71
|
-
Customize your app experience with various settings and options.
|
|
72
|
-
</Text>
|
|
73
|
-
</View>
|
|
74
|
-
</View>
|
|
75
|
-
</Screen>
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const AppRouterWithTrpc: RouteParam = {
|
|
79
|
-
path: "/",
|
|
80
|
-
component: HomeScreen,
|
|
81
|
-
layout: {
|
|
82
|
-
type: "tab",
|
|
83
|
-
},
|
|
84
|
-
screenOptions: {
|
|
85
|
-
title: 'Home',
|
|
86
|
-
tabBarLabel: 'Home',
|
|
87
|
-
tabBarIcon: ({ focused, size }) => (
|
|
88
|
-
<Icon name="home" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
89
|
-
),
|
|
90
|
-
},
|
|
91
|
-
routes: [
|
|
92
|
-
{
|
|
93
|
-
path: "profile",
|
|
94
|
-
component: ProfileScreen,
|
|
95
|
-
screenOptions: {
|
|
96
|
-
title: 'Profile',
|
|
97
|
-
tabBarLabel: 'Profile',
|
|
98
|
-
tabBarIcon: ({ focused, size }) => (
|
|
99
|
-
<Icon name="account" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
100
|
-
),
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
path: "settings",
|
|
105
|
-
component: SettingsScreen,
|
|
106
|
-
screenOptions: {
|
|
107
|
-
title: 'Settings',
|
|
108
|
-
tabBarLabel: 'Settings',
|
|
109
|
-
tabBarIcon: ({ focused, size }) => (
|
|
110
|
-
<Icon name="cog" color={focused ? 'blue' : 'gray'} size={size || 24} />
|
|
111
|
-
),
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
export default AppRouterWithTrpc;
|