Skip to content

Commit 95dc083

Browse files
committed
chore: Rewrite HomeScreen & SlugScreen to use Nativewind classNames
1 parent 314ba99 commit 95dc083

File tree

3 files changed

+26
-79
lines changed

3 files changed

+26
-79
lines changed

apps/expo/app/ExpoRootLayout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import UniversalRootLayout from '@app/core/screens/UniversalRootLayout'
77
// -i- Use this file to apply your Expo specific layout setup:
88
// -i- like rendering our Universal Layout and App Providers
99

10+
/* --- <ExpoRootLayout> ------------------------------------------------------------------------ */
11+
1012
export default function ExpoRootLayout() {
1113
return (
1214
<UniversalAppProviders>
Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,22 @@
11
import React from 'react'
2-
import { StyleSheet, Text, View } from 'react-native'
3-
import { Link } from '../navigation/Link'
42
import { Image } from '../components/Image'
5-
import { H3, P } from '../components/Typography'
3+
import { View, H3, P, TextLink } from '../components/styled'
64

75
/* --- <HomeScreen/> --------------------------------------------------------------------------- */
86

97
const HomeScreen = () => {
108
return (
11-
<View style={styles.container}>
9+
<View className="flex flex-1 justify-center items-center">
1210
<Image src={require('../assets/aetherspaceLogo.png')} width={60} height={60} style={{ marginBottom: 12 }} />
13-
<H3 className="text-center">Expo + Next.js app routing 🚀</H3>
14-
<P className="mt-8 text-center">Open HomeScreen.tsx in features/app-core/screens to start working on your app</P>
15-
<Link href="/subpages/aetherspace" style={styles.link}>Test navigation</Link>
16-
<Link href="/images" style={styles.link}>Test images</Link>
11+
<H3 className="text-center">Expo + Next.js app routing 👋</H3>
12+
<P className="mt-2 text-center">Open HomeScreen.tsx in features/app-core/screens to start working on your app</P>
13+
<TextLink className="mt-4 text-center" href="/subpages/aetherspace">
14+
Test navigation
15+
</TextLink>
1716
</View>
1817
)
1918
}
2019

21-
/* --- Styles ---------------------------------------------------------------------------------- */
22-
23-
const styles = StyleSheet.create({
24-
container: {
25-
flex: 1,
26-
justifyContent: 'center',
27-
alignItems: 'center',
28-
},
29-
title: {
30-
fontWeight: 'bold',
31-
fontSize: 16,
32-
textAlign: 'center',
33-
},
34-
subtitle: {
35-
marginTop: 8,
36-
fontSize: 16,
37-
textAlign: 'center',
38-
},
39-
link: {
40-
marginTop: 16,
41-
fontSize: 16,
42-
color: 'blue',
43-
textAlign: 'center',
44-
textDecorationLine: 'underline',
45-
},
46-
})
47-
4820
/* --- Exports --------------------------------------------------------------------------------- */
4921

5022
export default HomeScreen
Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react'
2-
import { StyleSheet, Text, View } from 'react-native'
32
import { useRouteParams } from '@app/core/navigation/useRouteParams'
4-
import { Link } from '../navigation/Link'
3+
import { View, Text, H3, TextLink } from '../components/styled'
54
import { useRouter } from '../navigation/useRouter'
65

76
/* --- <SlugScreen/> --------------------------------------------------------------------------- */
@@ -17,71 +16,45 @@ const SlugScreen = (props) => {
1716
// -- Render --
1817

1918
return (
20-
<View style={styles.container}>
19+
<View className="flex flex-1 justify-center items-center">
2120
{showBackButton && (
2221
<Text
23-
style={{ ...styles.backButton, ...styles.link, textDecorationLine: 'none' }}
22+
className="text-blue-500 absolute top-8 web:top-0 left-0 p-4"
2423
onPress={back}
2524
>
2625
{`< Back`}
2726
</Text>
2827
)}
29-
<Text style={styles.title}>
28+
<H3>
3029
Page slug: {slug}
3130
{!!count && ` | count: ${count}`}
31+
</H3>
32+
<Text className="mt-2 text-base text-center">
33+
Need a more robust, Fully-Stacked, Full-Product, Universal App Setup?
3234
</Text>
33-
<Text style={styles.subtitle}>Need a more robust, Fully-Stacked, Full-Product, Universal App Setup?</Text>
34-
<Link href="https://github.com/Aetherspace/green-stack-starter-demo#readme" target="_blank" style={styles.link}>
35+
<TextLink
36+
href="https://github.com/Aetherspace/green-stack-starter-demo#readme"
37+
className="mt-4 text-center"
38+
target="_blank"
39+
>
3540
Check out the GREEN Stack Starter
36-
</Link>
37-
<Text style={styles.link} onPress={() => push('/subpages/push')}>
41+
</TextLink>
42+
<Text className="mt-4 text-center text-blue-500 underline" onPress={() => push('/subpages/push')}>
3843
{`router.push()`}
3944
</Text>
40-
<Text style={styles.link} onPress={() => navigate('/subpages/navigate')}>
45+
<Text className="mt-4 text-center text-blue-500 underline" onPress={() => navigate('/subpages/navigate')}>
4146
{`router.navigate()`}
4247
</Text>
43-
<Text style={styles.link} onPress={() => replace('/subpages/replace')}>
48+
<Text className="mt-4 text-center text-blue-500 underline" onPress={() => replace('/subpages/replace')}>
4449
{`router.replace()`}
4550
</Text>
46-
<Text style={styles.link} onPress={() => setParams({ count: `${+count + 1}` })}>
51+
<Text className="mt-4 text-center text-blue-500 underline" onPress={() => setParams({ count: `${+count + 1}` })}>
4752
{`router.setParams()`}
4853
</Text>
4954
</View>
5055
)
5156
}
5257

53-
/* --- Styles ---------------------------------------------------------------------------------- */
54-
55-
const styles = StyleSheet.create({
56-
container: {
57-
flex: 1,
58-
justifyContent: 'center',
59-
alignItems: 'center',
60-
},
61-
backButton: {
62-
position: 'absolute',
63-
top: 16,
64-
left: 16,
65-
},
66-
title: {
67-
fontWeight: 'bold',
68-
fontSize: 16,
69-
textAlign: 'center',
70-
},
71-
subtitle: {
72-
marginTop: 8,
73-
fontSize: 16,
74-
textAlign: 'center',
75-
},
76-
link: {
77-
marginTop: 16,
78-
fontSize: 16,
79-
color: 'blue',
80-
textAlign: 'center',
81-
textDecorationLine: 'underline',
82-
},
83-
})
84-
8558
/* --- Exports --------------------------------------------------------------------------------- */
8659

8760
export default SlugScreen

0 commit comments

Comments
 (0)