create-granite-app 0.0.1 → 0.1.1
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/CHANGELOG.md +13 -0
- package/package.json +1 -1
- package/templates/granite-app/package.json +5 -5
- package/templates/granite-app/pages/about.tsx +1 -0
- package/templates/granite-app/pages/index.tsx +1 -16
- package/templates/granite-app/src/pages/about.tsx +70 -0
- package/templates/granite-app/src/pages/index.tsx +104 -0
- package/templates/granite-app/src/router.gen.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# create-granite-app
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d675415: Improve scaffolding to provide a better showcase UI
|
|
8
|
+
- 10a5f3f: empty
|
|
9
|
+
|
|
10
|
+
## 0.1.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 561a3ed: fix: docs deadlink
|
|
15
|
+
|
|
3
16
|
## 0.0.3
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"typecheck": "tsc --noEmit"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@granite-js/react-native": "0.
|
|
12
|
-
"@granite-js/native": "0.
|
|
11
|
+
"@granite-js/react-native": "0.1.1",
|
|
12
|
+
"@granite-js/native": "0.1.1",
|
|
13
13
|
"react": "18.2.0",
|
|
14
14
|
"react-native": "0.72.6"
|
|
15
15
|
},
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"@types/jest": "^29.5.14",
|
|
22
22
|
"@types/node": "^22.10.2",
|
|
23
23
|
"@types/react": "18.3.3",
|
|
24
|
-
"@granite-js/plugin-router": "0.
|
|
25
|
-
"@granite-js/plugin-hermes": "0.
|
|
26
|
-
"babel-preset-granite": "0.
|
|
24
|
+
"@granite-js/plugin-router": "0.1.1",
|
|
25
|
+
"@granite-js/plugin-hermes": "0.1.1",
|
|
26
|
+
"babel-preset-granite": "0.1.1",
|
|
27
27
|
"react-test-renderer": "18.2.0",
|
|
28
28
|
"jest": "^29.7.0",
|
|
29
29
|
"typescript": "^5.8.3"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Route } from 'pages/about';
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Text, View } from 'react-native';
|
|
3
|
-
import { createRoute } from '@granite-js/react-native';
|
|
4
|
-
|
|
5
|
-
export const Route = createRoute('/', {
|
|
6
|
-
validateParams: (params) => params,
|
|
7
|
-
component: Index,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export function Index() {
|
|
11
|
-
return (
|
|
12
|
-
<View>
|
|
13
|
-
<Text>Hello Index</Text>
|
|
14
|
-
</View>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
1
|
+
export { Route } from 'pages/index';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { createRoute } from '@granite-js/react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export const Route = createRoute('/about', {
|
|
6
|
+
component: Page,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
function Page() {
|
|
10
|
+
const navigation = Route.useNavigation();
|
|
11
|
+
|
|
12
|
+
const handleGoBack = () => {
|
|
13
|
+
navigation.goBack();
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<View style={styles.container}>
|
|
18
|
+
<Text style={styles.title}>About Granite</Text>
|
|
19
|
+
<Text style={styles.description}>Granite is a powerful and flexible React Native Framework 🚀</Text>
|
|
20
|
+
<TouchableOpacity style={styles.button} onPress={handleGoBack}>
|
|
21
|
+
<Text style={styles.buttonText}>Go Back</Text>
|
|
22
|
+
</TouchableOpacity>
|
|
23
|
+
</View>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const styles = StyleSheet.create({
|
|
28
|
+
container: {
|
|
29
|
+
flex: 1,
|
|
30
|
+
padding: 24,
|
|
31
|
+
backgroundColor: '#F7FAFC',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
},
|
|
35
|
+
title: {
|
|
36
|
+
fontSize: 28,
|
|
37
|
+
fontWeight: 'bold',
|
|
38
|
+
color: '#1A202C',
|
|
39
|
+
marginBottom: 16,
|
|
40
|
+
textAlign: 'center',
|
|
41
|
+
},
|
|
42
|
+
description: {
|
|
43
|
+
fontSize: 18,
|
|
44
|
+
color: '#4A5568',
|
|
45
|
+
textAlign: 'center',
|
|
46
|
+
marginBottom: 12,
|
|
47
|
+
lineHeight: 26,
|
|
48
|
+
},
|
|
49
|
+
button: {
|
|
50
|
+
marginTop: 24,
|
|
51
|
+
backgroundColor: '#0064FF',
|
|
52
|
+
paddingVertical: 12,
|
|
53
|
+
paddingHorizontal: 32,
|
|
54
|
+
borderRadius: 8,
|
|
55
|
+
shadowColor: '#000',
|
|
56
|
+
shadowOffset: {
|
|
57
|
+
width: 0,
|
|
58
|
+
height: 2,
|
|
59
|
+
},
|
|
60
|
+
shadowOpacity: 0.25,
|
|
61
|
+
shadowRadius: 3.84,
|
|
62
|
+
elevation: 5,
|
|
63
|
+
},
|
|
64
|
+
buttonText: {
|
|
65
|
+
color: 'white',
|
|
66
|
+
fontSize: 16,
|
|
67
|
+
fontWeight: 'bold',
|
|
68
|
+
textAlign: 'center',
|
|
69
|
+
},
|
|
70
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { createRoute } from '@granite-js/react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export const Route = createRoute('/', {
|
|
6
|
+
component: Page,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
function Page() {
|
|
10
|
+
const navigation = Route.useNavigation();
|
|
11
|
+
|
|
12
|
+
const goToAboutPage = () => {
|
|
13
|
+
navigation.navigate('/about');
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Container>
|
|
18
|
+
<Text style={styles.title}>🎉 Welcome! 🎉</Text>
|
|
19
|
+
<Text style={styles.subtitle}>
|
|
20
|
+
This is a demo page for the <Text style={styles.brandText}>Granite</Text> Framework.
|
|
21
|
+
</Text>
|
|
22
|
+
<Text style={styles.description}>This page was created to showcase the features of the Granite.</Text>
|
|
23
|
+
<TouchableOpacity style={styles.button} onPress={goToAboutPage}>
|
|
24
|
+
<Text style={styles.buttonText}>Go to About Page</Text>
|
|
25
|
+
</TouchableOpacity>
|
|
26
|
+
</Container>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function Container({ children }: { children: React.ReactNode }) {
|
|
31
|
+
return <View style={styles.container}>{children}</View>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const styles = StyleSheet.create({
|
|
35
|
+
container: {
|
|
36
|
+
flex: 1,
|
|
37
|
+
padding: 16,
|
|
38
|
+
backgroundColor: 'white',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
},
|
|
42
|
+
brandText: {
|
|
43
|
+
color: '#0064FF',
|
|
44
|
+
fontWeight: 'bold',
|
|
45
|
+
},
|
|
46
|
+
text: {
|
|
47
|
+
fontSize: 24,
|
|
48
|
+
color: '#202632',
|
|
49
|
+
textAlign: 'center',
|
|
50
|
+
marginBottom: 10,
|
|
51
|
+
},
|
|
52
|
+
title: {
|
|
53
|
+
fontSize: 32,
|
|
54
|
+
fontWeight: 'bold',
|
|
55
|
+
color: '#1A202C',
|
|
56
|
+
textAlign: 'center',
|
|
57
|
+
marginBottom: 16,
|
|
58
|
+
},
|
|
59
|
+
subtitle: {
|
|
60
|
+
fontSize: 18,
|
|
61
|
+
color: '#4A5568',
|
|
62
|
+
textAlign: 'center',
|
|
63
|
+
marginBottom: 24,
|
|
64
|
+
},
|
|
65
|
+
description: {
|
|
66
|
+
fontSize: 16,
|
|
67
|
+
color: '#718096',
|
|
68
|
+
textAlign: 'center',
|
|
69
|
+
marginBottom: 32,
|
|
70
|
+
lineHeight: 24,
|
|
71
|
+
},
|
|
72
|
+
button: {
|
|
73
|
+
backgroundColor: '#0064FF',
|
|
74
|
+
paddingVertical: 12,
|
|
75
|
+
paddingHorizontal: 32,
|
|
76
|
+
borderRadius: 8,
|
|
77
|
+
shadowColor: '#000',
|
|
78
|
+
shadowOffset: {
|
|
79
|
+
width: 0,
|
|
80
|
+
height: 2,
|
|
81
|
+
},
|
|
82
|
+
shadowOpacity: 0.25,
|
|
83
|
+
shadowRadius: 3.84,
|
|
84
|
+
elevation: 5,
|
|
85
|
+
},
|
|
86
|
+
buttonText: {
|
|
87
|
+
color: 'white',
|
|
88
|
+
fontSize: 16,
|
|
89
|
+
fontWeight: 'bold',
|
|
90
|
+
textAlign: 'center',
|
|
91
|
+
},
|
|
92
|
+
codeContainer: {
|
|
93
|
+
padding: 8,
|
|
94
|
+
backgroundColor: '#333',
|
|
95
|
+
borderRadius: 4,
|
|
96
|
+
width: '100%',
|
|
97
|
+
},
|
|
98
|
+
code: {
|
|
99
|
+
color: 'white',
|
|
100
|
+
fontFamily: 'monospace',
|
|
101
|
+
letterSpacing: 0.5,
|
|
102
|
+
fontSize: 14,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
// This file is auto-generated by @granite-js/react-native. DO NOT EDIT.
|
|
3
|
-
import { Route as
|
|
3
|
+
import { Route as _AboutRoute } from '../pages/about';
|
|
4
|
+
import { Route as _IndexRoute } from '../pages/';
|
|
4
5
|
|
|
5
6
|
declare module '@granite-js/react-native' {
|
|
6
7
|
interface RegisterScreen {
|
|
8
|
+
'/about': ReturnType<typeof _AboutRoute.useParams>;
|
|
7
9
|
'/': ReturnType<typeof _IndexRoute.useParams>;
|
|
8
10
|
}
|
|
9
11
|
}
|