Skip to content

Commit ccee444

Browse files
committed
move nativewindui into styles
1 parent a565d0d commit ccee444

40 files changed

+2621
-194
lines changed

.changeset/slow-bugs-drop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'create-expo-stack': minor
3+
---
4+
5+
move nativewindui into styles

bun.lockb

201 KB
Binary file not shown.

cli/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"clean-build": "rm -rf ./build",
2727
"compile": "tsc -p .",
2828
"copy-templates": "bun run copyfiles -u 2 -a \"./src/templates/**/*\" ./build/templates",
29+
"dev": "bun run build && bun run bin/create-expo-stack.js",
2930
"format": "eslint \"**/*.{js,jsx,ts,tsx}\" --fix --resolve-plugins-relative-to . && prettier \"**/*.{js,jsx,ts,tsx,json}\" --write",
3031
"lint-templates": "bun run ejslint ./src/templates",
3132
"prepublishOnly": "bun run build",
@@ -48,6 +49,7 @@
4849
"dependencies": {
4950
"@clack/prompts": "^0.7.0",
5051
"ejs-lint": "^2.0.0",
52+
"expo": "^51.0.11",
5153
"figlet": "^1.6.0",
5254
"gluegun": "latest",
5355
"gradient-string": "^2.0.2"
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Learn more https://docs.expo.io/guides/customizing-metro
22
const { getDefaultConfig } = require('expo/metro-config');
3-
<% if (props.stylingPackage?.name === "nativewind") { %>
3+
<% if (props.stylingPackage?.name === "nativewind" || "nativewindui") { %>
44
const { withNativeWind } = require("nativewind/metro");
55
<% } %>
66
@@ -10,7 +10,8 @@ const config = getDefaultConfig(__dirname);
1010
1111
<% if (props.stylingPackage?.name === "nativewind") { %>
1212
module.exports = withNativeWind(config, { input: "./global.css" });
13+
<% } else if (props.stylingPackage?.name === "nativewindui") { %>
14+
module.exports = withNativeWind(config, { input: "./global.css", inlineRem: 16 });
1315
<% } else { %>
1416
module.exports = config;
15-
<% } %>
16-
17+
<% } %>

cli/src/templates/packages/expo-router/stack/app/_layout.tsx.ejs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<% if (props.stylingPackage?.name === "nativewind") { %>
22
import '../global.css';
3-
<% } else if (props.stylingPackage?.name === "nativewinui") { %>
4-
import '../global.css';
5-
import 'expo-dev-client';
63
<% } %>
4+
75
<% if (props.stylingPackage?.name === "unistyles") { %>
86
import '../unistyles';
97
<% } %>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Feather } from '@expo/vector-icons';
2+
import { Text, View, StyleSheet } from 'react-native';
3+
4+
export const BackButton = ({ onPress }: { onPress: () => void }) => {
5+
return (
6+
<View style={styles.backButton}>
7+
<Feather name="chevron-left" size={16} color="#007AFF" />
8+
<Text style={styles.backButtonText} onPress={onPress}>
9+
Back
10+
</Text>
11+
</View>
12+
);
13+
};
14+
const styles = StyleSheet.create({
15+
backButton: {
16+
flexDirection: 'row',
17+
paddingLeft: 20,
18+
},
19+
backButtonText: {
20+
color: '#007AFF',
21+
marginLeft: 4,
22+
},
23+
});
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { forwardRef } from 'react';
2+
import { StyleSheet, Text, TouchableOpacity, TouchableOpacityProps } from 'react-native';
3+
4+
type ButtonProps = {
5+
onPress?: TouchableOpacityProps['onPress'];
6+
title?: string;
7+
} & TouchableOpacityProps;
8+
9+
export const Button = forwardRef<TouchableOpacity, ButtonProps>(({ onPress, title }, ref) => {
10+
return (
11+
<TouchableOpacity ref={ref} style={styles.button} onPress={onPress}>
12+
<Text style={styles.buttonText}>{title}</Text>
13+
</TouchableOpacity>
14+
);
15+
});
16+
17+
const styles = StyleSheet.create({
18+
button: {
19+
alignItems: 'center',
20+
backgroundColor: '#6366F1',
21+
borderRadius: 24,
22+
elevation: 5,
23+
flexDirection: 'row',
24+
justifyContent: 'center',
25+
padding: 16,
26+
shadowColor: '#000',
27+
shadowOffset: {
28+
height: 2,
29+
width: 0,
30+
},
31+
shadowOpacity: 0.25,
32+
shadowRadius: 3.84,
33+
},
34+
buttonText: {
35+
color: '#FFFFFF',
36+
fontSize: 16,
37+
fontWeight: '600',
38+
textAlign: 'center',
39+
},
40+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { StyleSheet, SafeAreaView } from 'react-native';
2+
3+
export const Container = ({ children }: { children: React.ReactNode }) => {
4+
return <SafeAreaView style={styles.container}>{children}</SafeAreaView>;
5+
};
6+
7+
const styles = StyleSheet.create({
8+
container: {
9+
flex: 1,
10+
padding: 24,
11+
},
12+
});
13+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { StyleSheet, Text, View } from 'react-native';
2+
3+
<% if (props.internalizationPackage?.name === "i18next") { %>
4+
import { useTranslation } from 'react-i18next';
5+
<% } %>
6+
7+
export default function EditScreenInfo({ path }: { path: string }) {
8+
<% if (props.internalizationPackage?.name === "i18next") { %>
9+
const { t } = useTranslation();
10+
const title = t('getStarted');
11+
const description = t('changeCode')
12+
<% } else { %>
13+
const title = "Open up the code for this screen:"
14+
const description = "Change any of the text, save the file, and your app will automatically update."
15+
<% } %>
16+
return (
17+
<View style={styles.getStartedContainer}>
18+
<Text style={styles.getStartedText}>{title}</Text>
19+
<View style={[styles.codeHighlightContainer, styles.homeScreenFilename]}>
20+
<Text>{path}</Text>
21+
</View>
22+
<Text style={styles.getStartedText}>{description}</Text>
23+
</View>
24+
);
25+
}
26+
27+
const styles = StyleSheet.create({
28+
codeHighlightContainer: {
29+
borderRadius: 3,
30+
paddingHorizontal: 4,
31+
},
32+
getStartedContainer: {
33+
alignItems: 'center',
34+
marginHorizontal: 50,
35+
},
36+
getStartedText: {
37+
fontSize: 17,
38+
lineHeight: 24,
39+
textAlign: 'center',
40+
},
41+
helpContainer: {
42+
alignItems: 'center',
43+
marginHorizontal: 20,
44+
marginTop: 15,
45+
},
46+
helpLink: {
47+
paddingVertical: 15,
48+
},
49+
helpLinkText: {
50+
textAlign: 'center',
51+
},
52+
homeScreenFilename: {
53+
marginVertical: 7,
54+
},
55+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { forwardRef } from 'react';
2+
import FontAwesome from '@expo/vector-icons/FontAwesome';
3+
import { Pressable, StyleSheet } from 'react-native';
4+
5+
export const HeaderButton = forwardRef<typeof Pressable, { onPress?: () => void; }>(({ onPress }, ref) => {
6+
return (
7+
<Pressable onPress={onPress}>
8+
{({ pressed }) => (
9+
<FontAwesome
10+
name="info-circle"
11+
size={25}
12+
color="gray"
13+
style={[
14+
styles.headerRight,
15+
{
16+
opacity: pressed ? 0.5 : 1,
17+
},
18+
]}
19+
/>
20+
)}
21+
</Pressable>
22+
);
23+
});
24+
25+
export const styles = StyleSheet.create({
26+
headerRight: {
27+
marginRight: 15,
28+
},
29+
});

0 commit comments

Comments
 (0)