<?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: Brian jacob</title>
    <description>The latest articles on DEV Community by Brian jacob (@handipriyono).</description>
    <link>https://dev.to/handipriyono</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%2F184332%2F3d8f407f-ff33-450e-81d5-03ddaefb44ae.jpg</url>
      <title>DEV Community: Brian jacob</title>
      <link>https://dev.to/handipriyono</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/handipriyono"/>
    <language>en</language>
    <item>
      <title>React Native Scaler: Perfecting App Aesthetics Across Multiple Devices</title>
      <dc:creator>Brian jacob</dc:creator>
      <pubDate>Sat, 13 Apr 2024 20:37:17 +0000</pubDate>
      <link>https://dev.to/handipriyono/react-native-scaler-perfecting-app-aesthetics-across-multiple-devices-3a52</link>
      <guid>https://dev.to/handipriyono/react-native-scaler-perfecting-app-aesthetics-across-multiple-devices-3a52</guid>
      <description>&lt;h2&gt;
  
  
  React-Native-Scaler
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;react-native-scaler&lt;/code&gt; is a library that provides a set of scaling functions to help you make your React Native app responsive. It exports an &lt;code&gt;initScalers&lt;/code&gt; function that returns four scaling functions: &lt;code&gt;scaleWidth&lt;/code&gt;, &lt;code&gt;scaleHeight&lt;/code&gt;, &lt;code&gt;moderateScaleWidth&lt;/code&gt;, and &lt;code&gt;moderateScaleHeight&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&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;react-native-scaler


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

&lt;/div&gt;

&lt;p&gt;OR&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

yarn add react-native-scaler


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

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fva5oy5znugz69p37zdw1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fva5oy5znugz69p37zdw1.png" alt="react-native-scaler"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Initialization
&lt;/h2&gt;

&lt;p&gt;Import the &lt;code&gt;initScalers&lt;/code&gt; function from the &lt;a href="https://www.npmjs.com/package/react-native-scaler" rel="noopener noreferrer"&gt;react-native-scaler&lt;/a&gt; library and initialize it with the base width and height of your design layout.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;initScalers&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="s1"&gt;react-native-scaler&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;scaleWidth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;scaleHeight&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;moderateScaleWidth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;moderateScaleHeight&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="nf"&gt;initScalers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;350&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;680&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;The numbers &lt;code&gt;350&lt;/code&gt; and &lt;code&gt;680&lt;/code&gt; represent the base width and height (in dp) of your design layout. You can adjust these values according to your needs.&lt;/p&gt;

&lt;p&gt;You can also initialize without passing any arguments, in which case the default base width and height will be used.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;scaleWidth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;scaleHeight&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;moderateScaleWidth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;moderateScaleHeight&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="nf"&gt;initScalers&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Additionally, you can use the shorthand notation for the scaling functions:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;sw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mh&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;initScalers&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;


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

&lt;/div&gt;
&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;After initialization, you can use the scaling functions in your components to scale dimensions according to the device's screen size.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;styles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;StyleSheet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;container&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;sw&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="c1"&gt;//same as scaleWidth(50)&lt;/span&gt;
    &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;sh&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="c1"&gt;//same as scaleHeight(100)&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;p&gt;You can also use the &lt;code&gt;moderateScaleWidth&lt;/code&gt; and &lt;code&gt;moderateScaleHeight&lt;/code&gt; functions with an optional factor. For example:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;styles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;StyleSheet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;container&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;mw&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;mh&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.7&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;h2&gt;
  
  
  Functions
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;initScalers&lt;/code&gt; function returns four scaling functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;scaleWidth (sw)&lt;/code&gt;: Scales a value based on the device's screen width.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;scaleHeight (sh)&lt;/code&gt;: Scales a value based on the device's screen height.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;moderateScaleWidth (mw)&lt;/code&gt;: Provides moderate scaling based on the device's screen width. It takes two parameters: &lt;code&gt;size&lt;/code&gt; and an optional &lt;code&gt;factor&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;moderateScaleHeight (mh)&lt;/code&gt;: Provides moderate scaling based on the device's screen height. It takes two parameters: &lt;code&gt;size&lt;/code&gt; and an optional &lt;code&gt;factor&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these functions takes a number as an argument and returns a scaled number.&lt;/p&gt;
&lt;h2&gt;
  
  
  ScaledSheet
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;ScaledSheet&lt;/code&gt; is a special feature of &lt;code&gt;react-native-scaler&lt;/code&gt; that allows you to automatically apply the scale functions in your stylesheets. It takes the same styles object as a regular &lt;code&gt;StyleSheet&lt;/code&gt;, but with an optional annotation that applies the scale functions for you.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ScaledSheet&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;scaleWidth&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;initScalers&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;styles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ScaledSheet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;container&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;50@sw&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;//same as scaleWidth(50)&lt;/span&gt;
    &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;100@sh&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;//same as scaleHeight(100)&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;p&gt;In the above example, &lt;code&gt;50@sw&lt;/code&gt; applies the &lt;code&gt;scaleWidth&lt;/code&gt; function to the size &lt;code&gt;50&lt;/code&gt;, and &lt;code&gt;100@sh&lt;/code&gt; applies the &lt;code&gt;scaleHeight&lt;/code&gt; function to the size &lt;code&gt;100&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can also use &lt;code&gt;@mw&lt;/code&gt; and &lt;code&gt;@mh&lt;/code&gt; to apply &lt;code&gt;moderateScaleWidth&lt;/code&gt; and &lt;code&gt;moderateScaleHeight&lt;/code&gt; respectively, with a resize factor of &lt;code&gt;0.5&lt;/code&gt;. If you want to specify a different resize factor, you can do so by appending it after &lt;code&gt;@mw&lt;/code&gt; or &lt;code&gt;@mh&lt;/code&gt;, like &lt;code&gt;50@mw0.3&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here is an example of using &lt;code&gt;ScaledSheet&lt;/code&gt; with &lt;code&gt;moderateScaleWidth&lt;/code&gt; and &lt;code&gt;moderateScaleHeight&lt;/code&gt; with a resize factor:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;styles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ScaledSheet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;container&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;10@mw0.3&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// = moderateScaleWidth(10, 0.3)&lt;/span&gt;
    &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;50@mw&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// = moderateScaleWidth(50)&lt;/span&gt;
    &lt;span class="na"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2@mw&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// moderateScaleWidth(2)&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;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;p&gt;It's recommended to initialize the scaler in a specific file or hook, so it can be reused across different components, instead of initializing it in every page. Here's an example of how you can do this:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="c1"&gt;// scaler.js&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;initScalers&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="s1"&gt;react-native-scaler&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&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;sw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ScaledSheet&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;initScalers&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Then, in your component file, you can import the scaling functions and &lt;code&gt;ScaledSheet&lt;/code&gt; from &lt;code&gt;scaler.js&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="c1"&gt;// MyComponent.js&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;sw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ScaledSheet&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="s1"&gt;./scaler&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;styles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ScaledSheet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;container&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;50@sw&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;100@sh&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;

</description>
      <category>reactnative</category>
      <category>responsive</category>
      <category>react</category>
      <category>mobile</category>
    </item>
    <item>
      <title>React Native TypeScript Boilerplate ( 2024 )</title>
      <dc:creator>Brian jacob</dc:creator>
      <pubDate>Sun, 31 Jul 2022 06:09:00 +0000</pubDate>
      <link>https://dev.to/handipriyono/react-native-typescript-boilerplate-49gk</link>
      <guid>https://dev.to/handipriyono/react-native-typescript-boilerplate-49gk</guid>
      <description>&lt;p&gt;React Native TypeScript Boilerplate 2024 –  There are many resources available online for developers looking to use boilerplates to streamline the process of building React Native apps. These boilerplates can come in the form of CLI templates or npm libraries, and some are even based on TypeScript. While it is not common to find React Native boilerplates that are TypeScript-based, there is a demand for these types of tools among developers who prefer to work with TypeScript in their React Native projects. In this article, we will explore the different types of React Native boilerplates and discuss the benefits of using them.&lt;/p&gt;

&lt;p&gt;In this article, I will not only discuss the various types of React Native boilerplates, but I will also provide a tutorial on how to use them. I will include links to the libraries and GitHub repositories so you can easily access and implement these tools in your own projects.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhandi.dev%2Fimages%2Freact%2520native%2520typescript%2520boilerplate.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhandi.dev%2Fimages%2Freact%2520native%2520typescript%2520boilerplate.webp" alt="react native boilerplate 2024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Best React Native Typescript Boilerplate 2024
&lt;/h2&gt;

&lt;p&gt;TypeScript is a programming language that is based on JavaScript and includes features such as strong typing and object-oriented programming concepts. These features can make it easier for developers to build complex applications, but some people find that the requirement to specify the types of variables and functions can be tedious. Despite this, many developers appreciate the benefits of using TypeScript, such as improved code quality and fewer runtime errors.&lt;/p&gt;

&lt;p&gt;Using TypeScript can have several benefits for developers. One of the main features of TypeScript is the requirement to specify the type or interface for every variable or function that is created. &lt;/p&gt;

&lt;p&gt;This helps to ensure that the variables and parameters being used are consistent with their declared type, which can improve code quality and reduce the risk of runtime errors. When a different value or parameter is added to a type that has already been declared, TypeScript will check for any discrepancies and throw an error if it detects a problem. Overall, this strict type-checking system helps to ensure that code is more reliable and easier to maintain.&lt;/p&gt;

&lt;h2&gt;
  
  
  React Native Typescript boilerplate with Redux
&lt;/h2&gt;

&lt;p&gt;TypeScript's strict type-checking system can be helpful in preventing bugs from appearing in the future. Now, let's return to the topic of React Native Boilerplates. I have recently created a Boilerplate for React Native that is based on TypeScript. Like other Boilerplates, this one is very basic and includes the essentials for starting a new React Native project. By using this TypeScript-based Boilerplate as a starting point, you can easily add any necessary libraries as you build your app from scratch. This can save time and effort in the long run, as you won't have to set up a basic Boilerplate from scratch each time you start a new project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Checklist for React-Native Boilerplate TypeScript
&lt;/h3&gt;

&lt;p&gt;Here I will review it again. What do you need to make a react native boilerplate?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Navigation&lt;/strong&gt;: It serves to navigate between screens. The most popular is react-navigation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State Management&lt;/strong&gt;: what is popular here is the redux toolkit. You can also use MOBX or Zustand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;React hooks&lt;/strong&gt;: React provides react hooks that make managing the lifecycle easier. For additional hooks in the fetch API, there’s also react-query that you can also use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;React Native icon&lt;/strong&gt;: icon is an essential thing in making an application. Without the icon, the application will feel like a blank newspaper. So I recommend using the react native vector icon, or you can also use your local icon.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Luckily, the React Native Boilerplate I will share with you already covers the basics needed to build a React Native app. The versions of all the libraries are up to date, so you don’t have to worry.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Feujtocnlz3pxs31z8r6i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Feujtocnlz3pxs31z8r6i.png" alt="React-Native Typescript boilerplate"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation and How to Use React Native Typescript boilerplate
&lt;/h3&gt;

&lt;p&gt;In the first step, just run the code below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 react-native init MyAppName --template @handidev/react-native-typescript-boilerplate

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

&lt;/div&gt;

&lt;p&gt;As a note, replace the word MyAppName with the application name you want.&lt;/p&gt;

&lt;p&gt;Next, after everything is successful, the next step is to run the React Native application based on the platform you choose.&lt;br&gt;
for the iOS version, run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

yarn ios


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

&lt;/div&gt;

&lt;p&gt;For the Android version, run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

yarn android


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

&lt;/div&gt;

&lt;p&gt;Yes, it’s that simple. If you have any problems with the installation, don’t hesitate to contact me on Github.&lt;/p&gt;

&lt;p&gt;Link to library react-native-typescript-boilerplate NPM: &lt;a href="https://www.npmjs.com/package/@handidev/react-native-typescript-boilerplate" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/@handidev/react-native-typescript-boilerplate&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Link to react-native typescript boilerplate GitHub repository: &lt;a href="https://github.com/handi-dev/react-native-typescript-boilerplate" rel="noopener noreferrer"&gt;https://github.com/handi-dev/react-native-typescript-boilerplate&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Possible Error and solutions:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Error /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in find_spec_for_exe: Could not find 'bundler' (2.1.4) required by your /Users/username/DEVELOPER/MyAppName/Gemfile.lock. (Gem::GemNotFoundException)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;To update to the latest version installed on your system, run bundle update --bundler.&lt;br&gt;
To install the missing version, run&lt;/code&gt;gem install bundler:2.1.4&lt;code&gt;&lt;br&gt;
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in activate_bin_path&lt;br&gt;
from /usr/bin/bundle:23:in &amp;lt;main&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;✖ Installing Bundler&lt;br&gt;
&lt;code&gt;error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution:
&lt;/h3&gt;

&lt;p&gt;follow step below:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;brew install rbenv&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rbenv install 2.7.5&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rbenv local 2.7.5&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;export PATH="$HOME/.rbenv/shims:$PATH"&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;source: &lt;a href="https://handi.dev/blog/best-react-native-typescript-boilerplate" rel="noopener noreferrer"&gt;React Native TypeScript Boilerplate 2023&lt;/a&gt;&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>javascript</category>
      <category>react</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>How to Solve React Native Build Failed on M1 Macbook Pro / Air</title>
      <dc:creator>Brian jacob</dc:creator>
      <pubDate>Sun, 27 Jun 2021 19:13:00 +0000</pubDate>
      <link>https://dev.to/handipriyono/solve-react-native-build-failed-on-m1-macbook-pro-air-2fo4</link>
      <guid>https://dev.to/handipriyono/solve-react-native-build-failed-on-m1-macbook-pro-air-2fo4</guid>
      <description>&lt;p&gt;Apple has just released its newest Macbook series using Apple's M1 chip. It offers better speed, both in performance and battery life.&lt;/p&gt;

&lt;p&gt;In this case, developers are interested in flocking to replace their old MacBook with the M1 chip. However, in addition to the advantages of the MacBook Pro M1, there are shortcomings in terms of application development. Some applications are not yet compatible with this Apple M1 chip.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Set up, Build, and Run a React Native App on Macbook Pro M1 Chip
&lt;/h2&gt;

&lt;p&gt;React Native is a JavaScript framework that allows native iOS and Android applications to be rendered. It makes creating two applications on different platforms more straightforward with one source code. One of the difficulties faced in developing React Native applications through MacBook Pro / Macbook Air with this M1 chip is when we want to build/run the application.&lt;/p&gt;

&lt;p&gt;Many developers have experienced failure building react native applications through this MacBook M1.&lt;br&gt;
However, don't worry because I will share tips for you to deal with errors when making an iOS application on a MacBook Pro or MacBook Air M1 Apple Silicon chip.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhandi.dev%2F_next%2Fimage%3Furl%3D%252Fstatic%252Fimages%252Freact-native-error-macbook-m1.png%26w%3D3840%26q%3D75" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhandi.dev%2F_next%2Fimage%3Furl%3D%252Fstatic%252Fimages%252Freact-native-error-macbook-m1.png%26w%3D3840%26q%3D75" alt="Set up an M1 MacBook Pro for React Native"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  React Native Build Failed on Macbook Pro M1
&lt;/h2&gt;

&lt;p&gt;maybe you are unable to run react-native run-ios on M1 Macbook. The error output that you will get when you build react native iOS is as below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

The following build commands failed:
CompileC /Users/[username]/Library/Developer/Xcode/DerivedData/reactNativeBoilerplate-atkaxzsfrfdlfocjvyvemwywinew/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper-Folly.build/Object. Users/[username]/[folder-path]/ios/Pods/Flipper-Folly/folly/synchronization/DistributedMutex.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
&lt;span class="o"&gt;(&lt;/span&gt;1 failure&lt;span class="o"&gt;)&lt;/span&gt;


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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Solution to Run and Build React Native on M1 Macbook Pro
&lt;/h3&gt;

&lt;p&gt;The solution to React Native build failure on M1 Macbook is to use Rosetta. What is rosetta? &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Rosetta_(software)" rel="noopener noreferrer"&gt;Rosetta&lt;/a&gt; is a dynamic binary translator developed by Apple Inc. for macOS, an application compatibility layer between different instruction set architectures. It gives developers and consumers a transition period to update their application software to run on newer hardware by "translating" it to run on the different architecture.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you're using a MacBook Pro/Air with an M1/Apple silicon chip, you might be asked to install Rosetta to open an app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhandi.dev%2F_next%2Fimage%3Furl%3D%252Fstatic%252Fimages%252Fasking-install-rosetta-macbook.jpg%26w%3D828%26q%3D75" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhandi.dev%2F_next%2Fimage%3Furl%3D%252Fstatic%252Fimages%252Fasking-install-rosetta-macbook.jpg%26w%3D828%26q%3D75" alt="rosetta"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;Set Terminal App to use Rosetta&lt;/code&gt;:.
Select the app in Finder. Applications/Utilities/Terminal (App terminals). 
From the File menu in the menu bar, choose Get Info.
Make a checklist on: ( Open Using Rosetta ). See the image below.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhandi.dev%2F_next%2Fimage%3Furl%3D%252Fstatic%252Fimages%252Fterminal-mac-os-rosetta.png%26w%3D750%26q%3D75" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhandi.dev%2F_next%2Fimage%3Furl%3D%252Fstatic%252Fimages%252Fterminal-mac-os-rosetta.png%26w%3D750%26q%3D75" alt="setting rosetta for terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;Set Xcode to use Rosetta&lt;/code&gt;:.
Select the Xcode app in Finder. Applications/Xcode (Xcode App). 
From the File menu in the menu bar, choose Get Info.
Make a checklist on ( Open Using Rosetta )&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhandi.dev%2F_next%2Fimage%3Furl%3D%252Fstatic%252Fimages%252Fxcode-rosetta.png%26w%3D750%26q%3D75" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhandi.dev%2F_next%2Fimage%3Furl%3D%252Fstatic%252Fimages%252Fxcode-rosetta.png%26w%3D750%26q%3D75" alt="setting rosetta for xcode"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Delete the necessary folders so the build process can be successful and smooth.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;delete the Pods/ folder in  your-project-dir/ios/Pods&lt;/li&gt;
&lt;li&gt;delete podfile.lock in -&amp;gt; your-project-dir/ios/Podfile.lock&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you use the old code of React Native, or if you experience an error like what I said the first time, you can follow the next steps below. However, if you've just built react Native init on your MacBook M1, that shouldn't be a problem, and you should be able to build the React native ios on your MacBook smoothly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The next step is to modify the Podfile in the iOS folder. your-project-dir/ios/Podfile. navigate to your react native project, and open it in the editor.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Find code below: ( your-project-dir/ios/Podfile )&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

use_flipper!&lt;span class="o"&gt;()&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;And, replace with: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

use_flipper!&lt;span class="o"&gt;({&lt;/span&gt; &lt;span class="s1"&gt;'Flipper-Folly'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'2.5.3'&lt;/span&gt;, &lt;span class="s1"&gt;'Flipper'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'0.75.1'&lt;/span&gt;, &lt;span class="s1"&gt;'Flipper-RSocket'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'1.3.1'&lt;/span&gt; &lt;span class="o"&gt;})&lt;/span&gt;


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

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;The next step, install React native project as usual. Navigate to the root project directory, and run:
```bash
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;npx pod-install&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
7. Next, run npx react-native run-ios from your terminal.
```bash


npx react-native run-ios


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

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhandi.dev%2F_next%2Fimage%3Furl%3D%252Fstatic%252Fimages%252Fsuccess-build-react-native-macbook-pro-m1-chip.png%26w%3D3840%26q%3D75" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fhandi.dev%2F_next%2Fimage%3Furl%3D%252Fstatic%252Fimages%252Fsuccess-build-react-native-macbook-pro-m1-chip.png%26w%3D3840%26q%3D75" alt="build react native on MacBook m1 success"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above method should be smooth and run well on iOS Emulator. Good Luck!&lt;br&gt;
original article: &lt;a href="https://handi.dev/blog/how-run-react-native-on-macbook-m1-apple-silicon" rel="noopener noreferrer"&gt;handi.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;read also: &lt;a href="https://dev.to/handipriyono/react-native-scaler-perfecting-app-aesthetics-across-multiple-devices-3a52"&gt;React Native Scaler: Perfecting App Aesthetics Across Multiple Devices &lt;/a&gt;&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>javascript</category>
      <category>react</category>
      <category>mobile</category>
    </item>
    <item>
      <title>React Native Boilerplate 2024</title>
      <dc:creator>Brian jacob</dc:creator>
      <pubDate>Sat, 05 Dec 2020 10:27:00 +0000</pubDate>
      <link>https://dev.to/handipriyono/react-native-boilerplate-2021-27m</link>
      <guid>https://dev.to/handipriyono/react-native-boilerplate-2021-27m</guid>
      <description>&lt;p&gt;React native boilerplate 2024: React Native is a framework for building native mobile applications using JavaScript. It allows developers who are familiar with JavaScript to build apps that can run on both Android and iOS platforms using the same codebase. This can be a great time-saver for developers who want to build apps that can be used on multiple platforms, as they can use their existing knowledge of JavaScript to do so. Additionally, because React Native uses native components to render the user interface, the apps that are built with it have a native feel and perform well on mobile devices.&lt;/p&gt;

&lt;p&gt;Latest version: React Native 0.73.1.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Debugging Improvements
Stable Symlink Support in Metro
Kotlin Template on Android
Android 14 Support
New Architecture Updates
Deprecated Debugging Features
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Updated info of Library &amp;amp; package version of this React Native Boilerplate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"react-native": "0.73.1",&lt;/li&gt;
&lt;li&gt;"@react-native-masked-view/masked-view": "^0.3.1",&lt;/li&gt;
&lt;li&gt;"@react-navigation/bottom-tabs": "^6.5.11",&lt;/li&gt;
&lt;li&gt;"@react-navigation/material-top-tabs": "^6.6.5",&lt;/li&gt;
&lt;li&gt;"@react-navigation/native": "^6.1.9",&lt;/li&gt;
&lt;li&gt;"@react-navigation/native-stack": "^6.9.17",&lt;/li&gt;
&lt;li&gt;"@react-navigation/stack": "^6.3.20",&lt;/li&gt;
&lt;li&gt;"react": "18.2.0",&lt;/li&gt;
&lt;li&gt;"react-native-gesture-handler": "^2.14.0",&lt;/li&gt;
&lt;li&gt;"react-native-pager-view": "^6.2.3",&lt;/li&gt;
&lt;li&gt;"react-native-safe-area-context": "^4.8.2",&lt;/li&gt;
&lt;li&gt;"react-native-screens": "^3.29.0",&lt;/li&gt;
&lt;li&gt;"react-native-tab-view": "^3.5.2",&lt;/li&gt;
&lt;li&gt;"react-native-vector-icons": "^10.0.3"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F08thz1dkxexu82lbcahy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F08thz1dkxexu82lbcahy.png" alt="react native boilerplate 2024" width="800" height="565"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  React-Native Boilerplate 2024
&lt;/h2&gt;

&lt;p&gt;One common problem when developing stable apps is managing the structure of the files and folders in your project. It's important to follow best practices for organizing your code, and to only use libraries that are necessary for your project. Avoid installing libraries that you don't actually use in your code. Instead, it's better to remove any unnecessary libraries from your project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Criteria for the Best React Native Boilerplate
&lt;/h3&gt;

&lt;p&gt;If you are starting a new React Native project from scratch, it can be helpful to use a boilerplate. A boilerplate is a pre-built project structure that follows best practices and is optimized for performance.&lt;/p&gt;

&lt;p&gt;There are many different React Native boilerplates available, and it's important to choose one that is regularly updated. This is because libraries and the React Native framework itself are constantly being updated, so an outdated boilerplate may not be compatible with the latest versions.&lt;/p&gt;

&lt;p&gt;To find a reliable boilerplate, you can check the change log on the repository of the boilerplate you are considering, to see how often it is updated.&lt;/p&gt;

&lt;p&gt;Using an old, unmaintained boilerplate template for your React Native project can lead to poor performance and compatibility issues. To ensure that your app runs smoothly and is free of any problems, it's important to use a boilerplate that is actively maintained and kept up-to-date with the latest changes in the React Native framework and libraries. Cloning an outdated boilerplate template could cause issues with your code and negatively impact the overall performance of your app.&lt;/p&gt;

&lt;p&gt;A good React Native boilerplate should include the following features:&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Navigation.
&lt;/h4&gt;

&lt;p&gt;React Navigation is a popular library that is often used to navigate between pages or screens in a React Native app. Many developers rely on this library to provide an easy and efficient way to navigate within their apps.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. State Management.
&lt;/h4&gt;

&lt;p&gt;There are several libraries that can be used for managing global state in a React Native app. These libraries allow you to store data that can be accessed from any screen in your app. Two popular options for managing global state are Redux and Redux Toolkit, as well as MobX. These libraries can help you centralize and manage your app's data more efficiently.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. React Hooks
&lt;/h4&gt;

&lt;p&gt;In addition to traditional React class, developers can also use the latest React Hooks to build their React Native apps. Some developers may also prefer to use a boilerplate that integrates &lt;a href="https://www.npmjs.com/package/@handidev/react-native-typescript-boilerplate" rel="noopener noreferrer"&gt;react native boilerplate with typescript&lt;/a&gt;, which is a programming language that adds static type checking to JavaScript. Whether you choose to use Hooks or TypeScript is a matter of personal preference and the specific needs of your project.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. React Native Icon
&lt;/h4&gt;

&lt;p&gt;Icons are a common element of many React Native projects, as they can help improve the appearance of an app. To use icons in your project, you can use the react-native-vector-icons library, which provides a wide variety of customizable icons. Alternatively, you can also import your own local icons and use them in your app.&lt;/p&gt;

&lt;p&gt;Keep in mind that every project has different requirements, so it's important to choose a boilerplate that is simple and flexible. You can always add additional libraries as needed to support new features in your project.&lt;/p&gt;

&lt;p&gt;As a React Native engineer with almost three years of experience, I have developed a boilerplate that I can use in any project. This boilerplate is simple and includes only the necessary libraries, as well as a well-organized folder structure. If you are starting a new React Native project, you may find this boilerplate helpful as it can provide a solid foundation for your project.&lt;/p&gt;

&lt;p&gt;I am willing to share my boilerplate with you and provide instructions on how to use it in your project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick start
&lt;/h2&gt;

&lt;p&gt;To create a new project using the boilerplate, run :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx react-native init MyApp --template @handidev/react-native-boilerplate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you prefer to use the TypeScript version of the boilerplate, you can run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx react-native init MyApp --template @handidev/react-native-typescript-boilerplate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: Make sure to replace &lt;code&gt;MyApp&lt;/code&gt; with the desired name for your app. If you have all the necessary requirements installed, you can run the project by using the following command:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;yarn start&lt;/code&gt; / &lt;code&gt;npm start -- -- reset-cache&lt;/code&gt;  to start the metro bundler, in a dedicated terminal&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npx react-native run-ios&lt;/code&gt; / &lt;code&gt;npx react-native run-android&lt;/code&gt;  to run the &lt;em&gt;platform&lt;/em&gt; application (remember to start a simulator or connect a device)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you got an error like: &lt;code&gt;The version of CocoaPods used to generate the lockfile (x.x.x) is higher than the version of the current executable (x.x.x),&lt;/code&gt; then you can upgrade your cocoapods version.&lt;/p&gt;

&lt;p&gt;If you install cocoapods using homebrew, you can use this command: &lt;code&gt;brew upgrade cocoapods&lt;/code&gt; if that does not work, try &lt;code&gt;brew install cocoapods&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you previously installed using &lt;code&gt;gem&lt;/code&gt; then use this command and run on your terminal: &lt;code&gt;sudo gem install cocoapods&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Make sure your cocoa pods version is updated after a run that command.&lt;/p&gt;

&lt;p&gt;To check your current version of cocoapods, run &lt;code&gt;pod --version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After that, don't forget to execute in your terminal &lt;code&gt;pod repo update&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And finally, run &lt;code&gt;npx pod install&lt;/code&gt;. The solutions above must solve those methods that problem.&lt;/p&gt;

&lt;p&gt;If none of the above steps are successful, you can try this last method: Remove the &lt;code&gt;Podfilelock&lt;/code&gt; file from the &lt;code&gt;ios&lt;/code&gt; folder and then run the &lt;code&gt;npx pod-install&lt;/code&gt; command. This may resolve any issues you are experiencing with running your React Native project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start the packager with &lt;code&gt;npm start&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Connect your device or use an emulator that's installed on your PC&lt;/li&gt;
&lt;li&gt;Run the test application:&lt;/li&gt;
&lt;li&gt;On Android: Run &lt;code&gt;npx react-native run-android&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;On iOS: Open &lt;code&gt;npx react-native run-ios&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope that this boilerplate will be helpful for you. If you have any questions or need assistance, you can find me on Github.&lt;/p&gt;

&lt;p&gt;Please consider forking and starring the repository if you find it useful. For complete installation instructions, you can visit the React Native Boilerplate 2024 Github repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  React Native Boilerplate Javascript version:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/handi-dev/react-native-boilerplate#quick-start" rel="noopener noreferrer"&gt;https://github.com/handi-dev/react-native-boilerplate#quick-start&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  React Native Boilerplate TypeScript version:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/handi-dev/react-native-typescript-boilerplate#readme" rel="noopener noreferrer"&gt;https://github.com/handi-dev/react-native-typescript-boilerplate#readme&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;original article: &lt;a href="https://handi.dev/blog/best-react-native-boilerplate-2021" rel="noopener noreferrer"&gt;React-Native Boilerplate 2024&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>reactnative</category>
      <category>javascript</category>
      <category>mobile</category>
    </item>
  </channel>
</rss>
