Skip to content

Commit 7f9c8bc

Browse files
committed
add support for nativewind v5 preview
1 parent d518002 commit 7f9c8bc

File tree

10 files changed

+32
-38
lines changed

10 files changed

+32
-38
lines changed

.changeset/yummy-wombats-roll.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'rn-new': minor
3+
'create-expo-stack': minor
4+
---
5+
6+
add support for nativewind v5 preview

cli/src/templates/base/babel.config.js.ejs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,7 @@ module.exports = function(api) {
2525
plugins.push('react-native-worklets/plugin');
2626
2727
return {
28-
<% if (props.stylingPackage?.name === "nativewind" || props.stylingPackage?.name === "nativewindui") { %>
29-
presets: [
30-
['babel-preset-expo', { jsxImportSource: 'nativewind' }],
31-
'nativewind/babel',
32-
],
33-
<% } else { %>
34-
presets: ['babel-preset-expo'],
35-
<% } %>
28+
presets: ['babel-preset-expo'],
3629
plugins,
3730
};
3831
};

cli/src/templates/base/package.json.ejs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
},
3232
"dependencies": {
3333
<% if (props.stylingPackage?.name === "nativewind" || props.stylingPackage?.name === "nativewindui") { %>
34-
"nativewind": "latest",
34+
"@tailwindcss/postcss": "^4.1.13",
35+
"nativewind": "5.0.0-preview.0",
36+
"postcss": "^8.5.6",
37+
"react-native-css": "^3.0.0-preview.5",
3538
<% } %>
3639
<% if (props.stylingPackage?.name === "nativewindui") { %>
3740
"@roninoss/icons": "^0.0.4",
@@ -148,7 +151,7 @@
148151
<% } %>
149152
150153
151-
"react-native-reanimated": "~4.1.0",
154+
"react-native-reanimated": "~4.1.1",
152155
"react-native-worklets": "0.5.1",
153156
154157
@@ -170,8 +173,8 @@
170173
"eslint-config-prettier": "^10.1.2",
171174
"prettier": "^3.2.5",
172175
<% if (props.stylingPackage?.name === "nativewind" || props.stylingPackage?.name === "nativewindui") { %>
173-
"tailwindcss": "^3.4.0",
174-
"prettier-plugin-tailwindcss": "^0.5.11",
176+
"tailwindcss": "^4.1.13",
177+
"prettier-plugin-tailwindcss": "^0.6.14",
175178
<% } %>
176179
<% if (props.stylingPackage?.name === "tamagui") { %>
177180
"@tamagui/babel-plugin": "^1.132.23",

cli/src/templates/packages/nativewind/app-env.d.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
1+
@import 'tailwindcss';
2+
@import 'nativewind/theme';
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
// Learn more https://docs.expo.io/guides/customizing-metro
12
const { getDefaultConfig } = require('expo/metro-config');
2-
const { withNativeWind } = require('nativewind/metro');
3+
const { withNativewind } = require('nativewind/metro');
34

4-
// eslint-disable-next-line no-undef
5+
/** @type {import('expo/metro-config').MetroConfig} */
56
const config = getDefaultConfig(__dirname);
67

7-
module.exports = withNativeWind(config, { input: './global.css' });
8+
module.exports = withNativewind(config);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// @ts-ignore
2+
/// <reference types="react-native-css/types" />
3+
4+
// NOTE: This file should not be edited and should be committed with your source code. It is generated by react-native-css. If you need to move or disable this file, please see the documentation.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
plugins: {
3+
'@tailwindcss/postcss': {}
4+
}
5+
};

cli/src/templates/packages/nativewind/tailwind.config.js.ejs

Lines changed: 0 additions & 15 deletions
This file was deleted.

cli/src/utilities/configureProjectFiles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ export function configureProjectFiles(
123123
'packages/nativewind/components/Container.tsx.ejs',
124124
'packages/nativewind/components/ScreenContent.tsx.ejs',
125125
'packages/nativewind/components/EditScreenInfo.tsx.ejs',
126-
'packages/nativewind/tailwind.config.js.ejs',
127-
'packages/nativewind/app-env.d.ts',
126+
'packages/nativewind/global.css',
128127
'packages/nativewind/metro.config.js',
129-
'packages/nativewind/global.css'
128+
'packages/nativewind/nativewind-env.d.ts',
129+
'packages/nativewind/postcss.config.mjs'
130130
];
131131

132132
files = [...files, ...nativewindFiles];

0 commit comments

Comments
 (0)