<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alireza Mohsini</title>
    <description>The latest articles on DEV Community by Alireza Mohsini (@aramoh3ni).</description>
    <link>https://dev.to/aramoh3ni</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F379577%2F0cc96358-7273-492c-b67b-bca3eef91017.jpg</url>
      <title>DEV Community: Alireza Mohsini</title>
      <link>https://dev.to/aramoh3ni</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aramoh3ni"/>
    <language>en</language>
    <item>
      <title>Taming the Beast: A Foolproof NativeWind + React Native Setup (v52+) - 2025</title>
      <dc:creator>Alireza Mohsini</dc:creator>
      <pubDate>Fri, 31 Oct 2025 14:08:19 +0000</pubDate>
      <link>https://dev.to/aramoh3ni/taming-the-beast-a-foolproof-nativewind-react-native-setup-v52-2025-4dd8</link>
      <guid>https://dev.to/aramoh3ni/taming-the-beast-a-foolproof-nativewind-react-native-setup-v52-2025-4dd8</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1589652717521-10c0d092dea9%3Fixlib%3Drb-4.0.3%26ixid%3DMnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8%26auto%3Dformat%26fit%3Dcrop%26w%3D1170%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1589652717521-10c0d092dea9%3Fixlib%3Drb-4.0.3%26ixid%3DMnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8%26auto%3Dformat%26fit%3Dcrop%26w%3D1170%26q%3D80" alt="Frustrated developer at a computer" width="1170" height="780"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you've tried to set up NativeWind (Tailwind CSS for React Native) in a new React Native project recently, you've likely run into a wall of cryptic errors involving the Metro bundler, the new &lt;code&gt;require&lt;/code&gt; context, and missing modules. The rapid evolution of the React Native ecosystem post-0.72, especially with the shift towards a more "web-aligned" build system, has broken many older guides.&lt;/p&gt;

&lt;p&gt;After much trial and error, I've found a specific combination of package versions that works together &lt;strong&gt;perfectly&lt;/strong&gt;. This setup will get you from zero to styled in minutes, not hours.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;After React Native 0.72, the introduction of the New Architecture by default and changes to how Metro handles assets broke the standard &lt;code&gt;tailwindcss&lt;/code&gt; setup. Common errors include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Unable to resolve module 'react-native-safe-area-context'&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Issues with the &lt;code&gt;require.context&lt;/code&gt; in the &lt;code&gt;tailwind.config.js&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Metro bundler failures when trying to compile the Tailwind CSS.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Solution: A Version-Locked, Battle-Tested Stack
&lt;/h2&gt;

&lt;p&gt;The key is using versions of &lt;code&gt;nativewind&lt;/code&gt; and &lt;code&gt;tailwindcss&lt;/code&gt; that are compatible with the latest React Native build system, along with the crucial, updated native dependencies.&lt;/p&gt;

&lt;p&gt;Here is the magic combination:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"nativewind"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"4.1.23"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tailwindcss"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"3.4.17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"react-native-reanimated"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"~3.16.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"react-native-safe-area-context"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"^4.12.0"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's set it up step-by-step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-by-Step Setup Guide
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Create a New React Native Project
&lt;/h3&gt;

&lt;p&gt;Start with a fresh project. I'll assume you're using the new "Compact" default template.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx react-native@latest init MyWindApp
&lt;span class="nb"&gt;cd &lt;/span&gt;MyWindApp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Install the Perfect Package Combo
&lt;/h3&gt;

&lt;p&gt;This is the most critical step. Run this install command to get the exact versions we need.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;nativewind@4.1.23 tailwindcss@3.4.17 react-native-reanimated@~3.16.1 react-native-safe-area-context@^4.12.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;nativewind@4.1.23&lt;/code&gt;&lt;/strong&gt;: This specific version is stable and avoids the compatibility issues present in some newer alpha/beta releases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;tailwindcss@3.4.17&lt;/code&gt;&lt;/strong&gt;: A stable, feature-complete version of Tailwind that works seamlessly with the NativeWind plugin.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;react-native-safe-area-context&lt;/code&gt;&lt;/strong&gt;: This is a required peer dependency for NativeWind to handle safe areas. Explicitly installing the latest stable version ensures it's present.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;react-native-reanimated&lt;/code&gt;&lt;/strong&gt;: While not always a direct dependency for basic NativeWind, many modern RN libraries use it, and having it installed preemptively prevents a very common class of errors.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 3: Configure Tailwind CSS
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Generate your &lt;code&gt;tailwind.config.js&lt;/code&gt; file.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx tailwindcss init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Update the generated &lt;code&gt;tailwind.config.js&lt;/code&gt; file. The critical part is configuring the &lt;code&gt;content&lt;/code&gt; paths so Tailwind can find your React Native components and purge unused styles.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// tailwind.config.js&lt;/span&gt;
&lt;span class="cm"&gt;/** @type {import('tailwindcss').Config} */&lt;/span&gt;
&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Important: Use `.native` for React Native&lt;/span&gt;
  &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./app/**/*.{js,jsx,ts,tsx}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/**/*.{js,jsx,ts,tsx}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;presets&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;nativewind/preset&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)],&lt;/span&gt;
  &lt;span class="na"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[],&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Configure Metro &amp;amp; Babel
&lt;/h3&gt;

&lt;p&gt;We need to tell Metro to process the CSS files that NativeWind will generate.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;metro config init&lt;/code&gt; or Create a &lt;code&gt;metro.config.js&lt;/code&gt; file or run in your project root if it doesn't exist, and add the following configuration:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// metro.config.js&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getDefaultConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;expo/metro-config&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;withNativeWind&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nativewind/metro&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getDefaultConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// This is the important part: Wrap the default config with NativeWind&lt;/span&gt;
&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;withNativeWind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./global.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note: If you aren't using Expo, you can often use &lt;code&gt;const { getDefaultConfig } = require("metro-config");&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Update your &lt;code&gt;babel.config.js&lt;/code&gt; to include the NativeWind Babel plugin.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// babel.config.js&lt;/span&gt;
&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;presets&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;module:@react-native/babel-preset&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="c1"&gt;// Add this line&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nativewind/babel&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Create Your Global CSS File
&lt;/h3&gt;

&lt;p&gt;Create a file called &lt;code&gt;global.css&lt;/code&gt; in your project root. This is where your Tailwind directives will live.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* global.css */&lt;/span&gt;
&lt;span class="k"&gt;@tailwind&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;@tailwind&lt;/span&gt; &lt;span class="n"&gt;components&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;@tailwind&lt;/span&gt; &lt;span class="n"&gt;utilities&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 6: Import the CSS and Apply the Provider
&lt;/h3&gt;

&lt;p&gt;Finally, we need to import the CSS and wrap our app with the &lt;code&gt;NativeWindProvider&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Open your &lt;code&gt;App.tsx&lt;/code&gt; (or &lt;code&gt;App.jsx&lt;/code&gt;) and modify it as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// App.tsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// 1. Import the CSS and the Provider&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;NativeWindProvider&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;nativewind&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./global.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Import the CSS file&lt;/span&gt;

&lt;span class="c1"&gt;// Your main App component&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="c1"&gt;// 2. Wrap your app with the NativeWindProvider&lt;/span&gt;
    &lt;span class="c1"&gt;// note: not required to wrap and use native-wind-provider&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;NativeWindProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Your existing app code starts here */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;View&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"flex-1 items-center justify-center bg-white"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text-4xl font-bold text-blue-500"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello, NativeWind!&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;StatusBar&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"auto"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;View&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;NativeWindProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  You're All Set! 🚀
&lt;/h2&gt;

&lt;p&gt;That's it! Now you can use Tailwind's intuitive utility classes directly in your React Native components using the &lt;code&gt;className&lt;/code&gt; prop.&lt;/p&gt;

&lt;p&gt;Run your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run android
&lt;span class="c"&gt;# or&lt;/span&gt;
npm run ios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see your beautifully styled "Hello, NativeWind!" text.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cache Clear:&lt;/strong&gt; If things look weird, always clear your Metro cache: &lt;code&gt;npm start -- --reset-cache&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restart Metro/Bundler:&lt;/strong&gt; After installing new native dependencies, fully stop and restart your Metro bundler.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check Versions:&lt;/strong&gt; Double-check your &lt;code&gt;package.json&lt;/code&gt; to ensure the versions match exactly. A single mismatched package can break the entire setup.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This combination of &lt;code&gt;nativewind@4.1.23&lt;/code&gt; and &lt;code&gt;tailwindcss@3.4.17&lt;/code&gt; has proven to be incredibly stable across multiple projects. It bypasses the current ecosystem growing pains and lets you focus on what's important: building a great app.&lt;/p&gt;

&lt;p&gt;I hope this saves you hours of frustration. Happy coding!&lt;/p&gt;




&lt;p&gt;Follow me on Linkedin &lt;a href="https://www.linkedin.com/in/aramoh3ni/" rel="noopener noreferrer"&gt;aramoh3ni&lt;/a&gt;&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>tailwindcss</category>
      <category>mobile</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How BEM (Block-Element-Modifier) CSS actually Work!</title>
      <dc:creator>Alireza Mohsini</dc:creator>
      <pubDate>Wed, 31 May 2023 12:51:52 +0000</pubDate>
      <link>https://dev.to/aramoh3ni/how-bem-block-element-modifier-css-actually-work-ogl</link>
      <guid>https://dev.to/aramoh3ni/how-bem-block-element-modifier-css-actually-work-ogl</guid>
      <description>&lt;p&gt;BEM, or Block-Element-Modifier, is a popular naming convention for writing CSS code. It was developed by the team at Yandex, a Russian search engine, as a way to create scalable and maintainable CSS code for their large and complex web projects. BEM has since become widely adopted by developers around the world and is recognized as one of the best practices for writing CSS.&lt;/p&gt;

&lt;p&gt;The basic idea behind BEM is to create modular, reusable code blocks that can be combined to build larger web components. Each block represents a distinct part of the user interface, such as a header, footer, navigation menu, or form. Blocks can then be broken down into smaller elements, which are the individual components that make up the block. For example, a navigation menu block might consist of elements like the menu items, the logo, and the search bar.&lt;/p&gt;

&lt;p&gt;BEM also allows for the use of modifiers, which are used to change the appearance or behavior of a block or element. Modifiers can be used to change the color, size, or layout of a block, or to add or remove certain features or functionality.&lt;/p&gt;

&lt;p&gt;The naming convention used in BEM is what makes it so powerful. Each block, element, and modifier is given a unique, descriptive name that reflects its purpose and function. This makes it easy for developers to understand and organize their code, and for designers to make changes to the design without breaking the CSS.&lt;/p&gt;

&lt;p&gt;Here's an example of how BEM might be used to stylea simple navigation menu:&lt;/p&gt;

&lt;h4&gt;
  
  
  HTML:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;nav&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;ul&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav__list"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav__item"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav__link"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav__item"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav__link nav__link--active"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;About&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav__item"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav__link"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Contact&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  CSS:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.nav&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* Styles for the navigation block */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.nav__list&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* Styles for the navigation list element */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.nav__item&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* Styles for the navigation item element */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.nav__link&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* Styles for the navigation link element */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.nav__link--active&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* Modifier for the active navigation link */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the "nav" block represents the overall navigation menu. The "nav_&lt;em&gt;list", "nav&lt;/em&gt;&lt;em&gt;item", and "nav&lt;/em&gt;&lt;em&gt;link" elements represent the different parts of the navigation menu. The "nav&lt;/em&gt;_link--active" modifier is used to style the active link in the navigation menu.&lt;/p&gt;

&lt;p&gt;One of the key benefits of BEM is that it allows for easy modification of the CSS code. If you need to change the style of the active navigation link, for example, you can simply update the "nav__link--active" modifier without affecting any ofthe other parts of the navigation menu. This makes it easier to maintain and update the CSS code over time, and reduces the risk of introducing errors or breaking the design.&lt;/p&gt;

&lt;p&gt;Another benefit of BEM is that it promotes modularity and reusability of code. By breaking down the user interface into smaller blocks and elements, developers can create more flexible and adaptable components that can be used across different parts of the website. This can help to speed up development time and reduce code redundancy, which is especially important for large and complex web projects.&lt;/p&gt;

&lt;p&gt;Overall, BEM is a powerful and flexible naming convention for writing CSS code. By using descriptive and consistent names for blocks, elements, and modifiers, developers can create more maintainable and scalable code that is easier to understand and modify over time. If you're looking for a best practice for writing CSS, BEM is definitely worth considering.&lt;/p&gt;

&lt;h4&gt;
  
  
  Learn More:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://getbem.com/introduction/" rel="noopener noreferrer"&gt;getbem.com/introduction&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>bem</category>
      <category>frontend</category>
    </item>
    <item>
      <title>What is Dependency Injection + NestJs</title>
      <dc:creator>Alireza Mohsini</dc:creator>
      <pubDate>Wed, 31 May 2023 12:45:06 +0000</pubDate>
      <link>https://dev.to/aramoh3ni/what-is-dependency-injection-nestjs-2koh</link>
      <guid>https://dev.to/aramoh3ni/what-is-dependency-injection-nestjs-2koh</guid>
      <description>&lt;h2&gt;
  
  
  Dependency Injection
&lt;/h2&gt;

&lt;p&gt;Dependency injection is a design pattern used in software engineering that involves injecting dependencies, or external objects, into a class or method instead of having the class or method create or find the objects itself.&lt;/p&gt;

&lt;p&gt;With dependency injection, the dependencies are provided to the class or method from outside, typically through constructor injection or setter injection. This makes the code more modular and easier to test, as the dependencies can be easily replaced with mock objects or stubs during testing.&lt;/p&gt;

&lt;p&gt;Let's say you have a UserService class that needs to interact with a UserRepository to fetch user data. In traditional software development, you might create an instance of the UserRepository class inside the UserService class. However, with dependency injection, you can inject the UserRepository instance into the UserService class instead.&lt;/p&gt;

&lt;p&gt;Here's an example of how to do this in NestJS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Injectable } from '@nestjs/common';
import { UserRepository } from './user.repository';

@Injectable()
export class UserService {
  constructor(private readonly userRepository: UserRepository) {}

  async getUserById(id: string): Promise&amp;lt;User&amp;gt; {
    return this.userRepository.findById(id);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the UserService class has a constructor that takes an instance of the UserRepository class as a parameter. The @Injectable() decorator tells NestJS that this class is injectable and should be managed by the dependency injection system.&lt;/p&gt;

&lt;p&gt;Now, when you want to use the UserService class in another class or module, you can simply import it and let NestJS handle the injection of the UserRepository instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Module } from '@nestjs/common';
import { UserController } from './user.controller';
import { UserService } from './user.service';
import { UserRepository } from './user.repository';

@Module({
  controllers: [UserController],
  providers: [UserService, UserRepository],
})
export class UserModule {}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the UserModule imports the UserController, UserService, and UserRepository classes and adds them to the module's providers array. This tells NestJS to create instances of these classes and manage their dependencies using the dependency injection system.&lt;/p&gt;

&lt;p&gt;Now, when you call the getUserById method on an instance of UserService, NestJS will automatically inject an instance of UserRepository into the constructor and use that instance to fetch user data. This makes the code more modular and easier to test, as you can easily replace the UserRepository instance with a mock object or stub during testing.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>typescript</category>
      <category>node</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
