<?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: Yeasin Arafat</title>
    <description>The latest articles on DEV Community by Yeasin Arafat (@y3asin).</description>
    <link>https://dev.to/y3asin</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%2F2267016%2F62753100-3e11-4174-92be-4663c227d435.png</url>
      <title>DEV Community: Yeasin Arafat</title>
      <link>https://dev.to/y3asin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/y3asin"/>
    <language>en</language>
    <item>
      <title>React Native Expo with NativeWind v4 and Typescript</title>
      <dc:creator>Yeasin Arafat</dc:creator>
      <pubDate>Mon, 11 Nov 2024 03:38:54 +0000</pubDate>
      <link>https://dev.to/y3asin/react-native-expo-with-nativewind-v4-and-typescript-38j3</link>
      <guid>https://dev.to/y3asin/react-native-expo-with-nativewind-v4-and-typescript-38j3</guid>
      <description>&lt;p&gt;I'm writing this because I faced the problem recently. When I was wasting my time, the solution was right in front of me in &lt;a href="https://www.nativewind.dev/getting-started/expo-router" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  Steps
&lt;/h2&gt;

&lt;p&gt;Create an expo app&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-expo-app@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this will create a template for your project.&lt;/p&gt;

&lt;h2&gt;
  
  
  NativeWind v4 installation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1
&lt;/h3&gt;

&lt;p&gt;Install &lt;strong&gt;nativewind&lt;/strong&gt; in expo with necessary packages given in doc&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx expo &lt;span class="nb"&gt;install &lt;/span&gt;nativewind tailwindcss react-native-reanimated react-native-safe-area-context
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2
&lt;/h3&gt;

&lt;p&gt;then run&lt;br&gt;
&lt;/p&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;p&gt;this will create an &lt;code&gt;tailwind.config.js&lt;/code&gt; file.&lt;br&gt;
and paste this, also find it in documentation of nativewind v4&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/&lt;span class="k"&gt;**&lt;/span&gt; @type &lt;span class="o"&gt;{&lt;/span&gt;import&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'tailwindcss'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.Config&lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt;/
module.exports &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  // NOTE: Update this to include the paths to all of your component files.
  content: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./app/**/*.{js,jsx,ts,tsx}"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;,
  presets: &lt;span class="o"&gt;[&lt;/span&gt;require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"nativewind/preset"&lt;/span&gt;&lt;span class="o"&gt;)]&lt;/span&gt;,
  theme: &lt;span class="o"&gt;{&lt;/span&gt;
    extend: &lt;span class="o"&gt;{}&lt;/span&gt;,
  &lt;span class="o"&gt;}&lt;/span&gt;,
  plugins: &lt;span class="o"&gt;[]&lt;/span&gt;,
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3
&lt;/h3&gt;

&lt;p&gt;Now, create a &lt;strong&gt;global.css&lt;/strong&gt; file in root directory.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4
&lt;/h3&gt;

&lt;p&gt;Update &lt;code&gt;babel.config.js&lt;/code&gt;. If you are using expo which is below 50 then follow &lt;a href="https://www.nativewind.dev/getting-started/expo-router" rel="noopener noreferrer"&gt;expo below 49 sdk&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;module.exports &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;api&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  api.cache&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    presets: &lt;span class="o"&gt;[&lt;/span&gt;
      &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"babel-preset-expo"&lt;/span&gt;, &lt;span class="o"&gt;{&lt;/span&gt; jsxImportSource: &lt;span class="s2"&gt;"nativewind"&lt;/span&gt; &lt;span class="o"&gt;}]&lt;/span&gt;,
      &lt;span class="s2"&gt;"nativewind/babel"&lt;/span&gt;,
    &lt;span class="o"&gt;]&lt;/span&gt;,
  &lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&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
&lt;/h3&gt;

&lt;p&gt;Create &lt;code&gt;metro.config.js&lt;/code&gt; if not have, then add this below codes. This is for &lt;code&gt;Expo SDK 50+&lt;/code&gt; only. If you are using expo which is below 50 then follow &lt;a href="https://www.nativewind.dev/getting-started/expo-router" rel="noopener noreferrer"&gt;expo below 49 sdk&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;const &lt;span class="o"&gt;{&lt;/span&gt; getDefaultConfig &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"expo/metro-config"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
const &lt;span class="o"&gt;{&lt;/span&gt; withNativeWind &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"nativewind/metro"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

module.exports &lt;span class="o"&gt;=&lt;/span&gt; withNativeWind&lt;span class="o"&gt;(&lt;/span&gt;config, &lt;span class="o"&gt;{&lt;/span&gt; input: &lt;span class="s2"&gt;"./global.css"&lt;/span&gt; &lt;span class="o"&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 6
&lt;/h3&gt;

&lt;p&gt;Create an &lt;code&gt;nativewind-env.d.ts&lt;/code&gt; file and add&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/// &amp;lt;reference &lt;span class="nv"&gt;types&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"nativewind/types"&lt;/span&gt; /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the final step, import the &lt;code&gt;global.css&lt;/code&gt; to the &lt;code&gt;app/_laybout.tsx&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;import &lt;span class="o"&gt;{&lt;/span&gt; Stack &lt;span class="o"&gt;}&lt;/span&gt; from &lt;span class="s2"&gt;"expo-router"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
import &lt;span class="k"&gt;*&lt;/span&gt; as SplashScreen from &lt;span class="s2"&gt;"expo-splash-screen"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
import &lt;span class="s2"&gt;"react-native-reanimated"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

import &lt;span class="s2"&gt;"../global.css"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;export &lt;/span&gt;default &lt;span class="k"&gt;function &lt;/span&gt;RootLayout&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;
    &amp;lt;Stack&amp;gt;
      &amp;lt;Stack.Screen &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"index"&lt;/span&gt; &lt;span class="nv"&gt;options&lt;/span&gt;&lt;span class="o"&gt;={{&lt;/span&gt; headerShown: &lt;span class="nb"&gt;false&lt;/span&gt; &lt;span class="o"&gt;}}&lt;/span&gt; /&amp;gt;
    &amp;lt;/Stack&amp;gt;
  &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, &lt;strong&gt;tailwindcss&lt;/strong&gt; is working in your react native expo project with NativeWind v4.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;import React from &lt;span class="s2"&gt;"react"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
import &lt;span class="o"&gt;{&lt;/span&gt; Text &lt;span class="o"&gt;}&lt;/span&gt; from &lt;span class="s2"&gt;"react-native"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
import &lt;span class="o"&gt;{&lt;/span&gt; SafeAreaView &lt;span class="o"&gt;}&lt;/span&gt; from &lt;span class="s2"&gt;"react-native-safe-area-context"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

const App &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;
    &amp;lt;SafeAreaView&amp;gt;
      &amp;lt;Text &lt;span class="nv"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"text-blue-600 font-bold text-3xl "&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        Creating app with expo
      &amp;lt;/Text&amp;gt;

    &amp;lt;/SafeAreaView&amp;gt;
  &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;h4&gt;
  
  
  Working...
&lt;/h4&gt;

&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fff3mxncj6v7xx22gtj02.png" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fff3mxncj6v7xx22gtj02.png" alt="Image description" width="800" height="1734"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: All these are written in the Official documentation of NativeWind. I just wanted to keep them here, so that no newbie face the problem like me and waste their precious time.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>expo</category>
      <category>nativewindv4</category>
      <category>reactnative</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Git Workflow with a "Lazy" Alias</title>
      <dc:creator>Yeasin Arafat</dc:creator>
      <pubDate>Thu, 24 Oct 2024 16:43:25 +0000</pubDate>
      <link>https://dev.to/y3asin/git-workflow-with-a-lazy-alias-3i7g</link>
      <guid>https://dev.to/y3asin/git-workflow-with-a-lazy-alias-3i7g</guid>
      <description>&lt;h2&gt;
  
  
  Steps to Set Up the "Lazy" Alias
&lt;/h2&gt;

&lt;p&gt;Open the Git Configuration File&lt;/p&gt;

&lt;h3&gt;
  
  
  On macOS or Linux, open your terminal and run:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; &lt;span class="nt"&gt;--edit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  On Windows, use:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add the Alias Using Vim
&lt;/h3&gt;

&lt;p&gt;Once the configuration file opens (by default in Vim), navigate to the section labeled [alias]. If it doesn't exist, create it.&lt;br&gt;
Add the following code under the [alias] section:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;alias&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    lazy &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"!f() { git add -A &amp;amp;&amp;amp; git commit -m &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="nv"&gt;$@&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt; &amp;amp;&amp;amp; git push; }; f"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Save and Exit
&lt;/h3&gt;

&lt;p&gt;In Vim, press Esc and type :wq to save and close the file.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;NOTE: Instead of "lazy" you can use any shortcut you want.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Usage of the "Lazy" Alias
&lt;/h2&gt;

&lt;p&gt;Now, you can commit and push changes with a single command. Simply type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git lazy &lt;span class="s2"&gt;"Your commit message"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
