<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[React-Native]]></title><description><![CDATA[React-Native]]></description><link>https://react-native-tailwindcss-nativewind.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 17 Jun 2026 20:34:36 GMT</lastBuildDate><atom:link href="https://react-native-tailwindcss-nativewind.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[🚀 Setting Up TailwindCSS in React Native Using NativeWind]]></title><description><![CDATA[TailwindCSS has become one of the most popular utility-first CSS frameworks for web development. But did you know you can now bring the power of Tailwind to your React Native projects too? With NativeWind, styling your mobile app becomes faster, more...]]></description><link>https://react-native-tailwindcss-nativewind.hashnode.dev/setting-up-tailwindcss-in-react-native-using-nativewind</link><guid isPermaLink="true">https://react-native-tailwindcss-nativewind.hashnode.dev/setting-up-tailwindcss-in-react-native-using-nativewind</guid><category><![CDATA[React Native]]></category><category><![CDATA[Tailwind CSS]]></category><category><![CDATA[nativewind]]></category><dc:creator><![CDATA[Sibu dhital]]></dc:creator><pubDate>Mon, 07 Apr 2025 03:07:59 GMT</pubDate><content:encoded><![CDATA[<p>TailwindCSS has become one of the most popular utility-first CSS frameworks for web development. But did you know you can now bring the power of Tailwind to your React Native projects too? With <strong>NativeWind</strong>, styling your mobile app becomes faster, more consistent, and even more fun.</p>
<p>In this blog, we’ll walk through the setup of TailwindCSS in a React Native app using <strong>NativeWind</strong> and explore how you can start using utility classes just like you would in a web app.</p>
<h2 id="heading-why-nativewind">🌱 Why NativeWind?</h2>
<p>NativeWind is a library that brings TailwindCSS-style utility classes to React Native. Here's why it’s worth checking out:</p>
<ul>
<li><p>💨 Write consistent styles using utility classes</p>
</li>
<li><p>🧱 No need for complex StyleSheet definitions</p>
</li>
<li><p>⚡ Optimized for performance</p>
</li>
<li><p>🌈 Supports variants like <code>dark</code>, <code>sm</code>, <code>md</code> via responsive classes</p>
</li>
<li><p>🔌 Works with Expo and bare React Native projects</p>
</li>
</ul>
<h2 id="heading-prerequisites">📦 Prerequisites</h2>
<p>Before you get started, make sure you have:</p>
<ul>
<li><p>Node.js installed</p>
</li>
<li><p>A React Native or Expo project setup</p>
</li>
<li><p>Basic knowledge of React Native development</p>
</li>
</ul>
<h2 id="heading-installation">🔧 Installation</h2>
<p>Here’s a quick rundown of how to install NativeWind and set up Tailwind configuration in your project.</p>
<ol>
<li><p><strong>Install NativeWind and Tailwind dependencies</strong></p>
<p> “npm install nativewind tailwindcss”</p>
</li>
<li><p><strong>Create global.css to your root project directory and paste following code</strong></p>
<pre><code class="lang-css"> <span class="hljs-keyword">@tailwind</span> base;
 <span class="hljs-keyword">@tailwind</span> components;
 <span class="hljs-keyword">@tailwind</span> utilities;
</code></pre>
</li>
<li><p><strong>Configure Tailwind (</strong><code>tailwind.config.js</code>)</p>
<p> run “npx tailwindcss init” then replace default content of tailwind.config.js with following:</p>
<pre><code class="lang-javascript"> <span class="hljs-comment">/** <span class="hljs-doctag">@type <span class="hljs-type">{import('tailwindcss').Config}</span> </span>*/</span>
 <span class="hljs-built_in">module</span>.exports = {
     <span class="hljs-comment">// <span class="hljs-doctag">NOTE:</span> Update this to include the paths to all of your component files.</span>
     <span class="hljs-attr">content</span>: [<span class="hljs-string">"./app/**/*.{js,jsx,ts,tsx}"</span>],
     <span class="hljs-attr">presets</span>: [<span class="hljs-built_in">require</span>(<span class="hljs-string">"nativewind/preset"</span>)],
     <span class="hljs-attr">theme</span>: {
         <span class="hljs-attr">extend</span>: {},
     },
     <span class="hljs-attr">plugins</span>: [],
 };
</code></pre>
</li>
<li><p><strong>Set up Babel config for NativeWind</strong></p>
<p> create babel.config.js in the root directory and paste following code</p>
<pre><code class="lang-javascript"> <span class="hljs-built_in">module</span>.exports = <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">api</span>) </span>{
     api.cache(<span class="hljs-literal">true</span>);
     <span class="hljs-keyword">return</span> {
         <span class="hljs-attr">presets</span>: [
             [<span class="hljs-string">"babel-preset-expo"</span>, { <span class="hljs-attr">jsxImportSource</span>: <span class="hljs-string">"nativewind"</span> }],
             <span class="hljs-string">"nativewind/babel"</span>,
         ],
         <span class="hljs-attr">plugins</span>: [],
     };
 };
</code></pre>
</li>
<li><p><strong>Wrap your app in the NativeWind provider</strong></p>
<p> inside the root layout i.e. app &gt; _layout.tsx import global.css</p>
</li>
</ol>
<h2 id="heading-testing-your-setup">🧪 Testing Your Setup</h2>
<p>After setup, test your config by replacing a component with something like:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { Text, View } <span class="hljs-keyword">from</span> <span class="hljs-string">"react-native"</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Index</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">return</span> (
        <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">View</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"flex-1 items-center justify-center"</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">Text</span> <span class="hljs-attr">className</span>=<span class="hljs-string">"text-3xl text-primary bg-secondary font-bold"</span>&gt;</span>
                Welcome to Expo Router!
            <span class="hljs-tag">&lt;/<span class="hljs-name">Text</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">View</span>&gt;</span></span>
    );
}
</code></pre>
<h2 id="heading-common-gotchas">⚠️ Common Gotchas</h2>
<ul>
<li><p>Don’t forget to restart your dev server after changes in the config</p>
</li>
<li><p>NativeWind uses className (not style) — make sure it's supported in the component you're styling</p>
</li>
<li><p>Tailwind utilities are not supported in all third-party libraries — use them with NativeWind-aware components</p>
</li>
</ul>
<h2 id="heading-additional-resources">📚 Additional Resources</h2>
<ul>
<li><p><a target="_blank" href="https://www.nativewind.dev">NativeWind Docs</a></p>
</li>
<li><p><a target="_blank" href="https://tailwindcss.com">TailwindCSS Docs</a></p>
</li>
<li><p><a target="_blank" href="https://reactnative.dev">React Native Docs</a></p>
</li>
</ul>
]]></content:encoded></item></channel></rss>