feat(cli): initialize react native project with NativeWind preconfigured #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: Add 'create-react-native' command for React Native + NativeWind scaffolding
TL;DR - adds a new command to initialize a react native (expo) project with NativeWind preconfigured and ready to go🚀
Description
This pull request introduces a new command,
create-react-native
, to the CLI. This feature addresses the request for a streamlined way to set up a React Native project with modern tooling i.e. NativeWind. It allows users to scaffold a new project using Expo, pre-configured with NativeWind, enabling the use of Tailwind CSS classes directly in their React Native components.The entire setup process is automated, from project initialization to dependency installation and configuration file generation.
Steps to run:
Run the new command to create a test project:
devcli create-react-native MyTestApp
Navigate into the new project directory:
cd MyTestApp
Start the Expo development server:
npx expo start
Open the app in an emulator or on a physical device using the ExpoGo app. The app should build and run without any errors, and the default screen should display content styled with Tailwind CSS classes.
Expo docs
Related Issue(s)
Resolves #27
Changes Made.
List and describe the main changes here:
Detailed Changes
New Command:
create-react-native <projectName>
create-react-native MyTestApp
.New File: initReactNative.js
npx create-expo-app
.nativewind
,react-native-reanimated
, andreact-native-safe-area-context
.tailwindcss
.npx tailwindcss init
to generate a base config file.git init
command.New File: config.js
tailwind.config.js
(basic tailwind config).global.css
(adds the tailwind imports).babel.config.js
(includes thenativewind/babel
plugin).metro.config.js
(wrapped withwithNativeWind
)._layout.tsx
(import the global styles so tailwind classes can be used anywhere in the project) .index.tsx
(write a custom Devcli welcome page).app.json
(adds required metro web bundler setting).Modified File: index.js
initReactNative
command, making it available to the user.Checklist
Please ensure the following have been completed:
If yes, do [x].
Dependencies
NIL
Additional Notes
Readme needs to be updated with the new command!