<?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: Olabisim</title>
    <description>The latest articles on DEV Community by Olabisim (@olabisim).</description>
    <link>https://dev.to/olabisim</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F850260%2Fafc7f8c3-c496-414d-b4e4-9e3518e1c4a8.png</url>
      <title>DEV Community: Olabisim</title>
      <link>https://dev.to/olabisim</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/olabisim"/>
    <language>en</language>
    <item>
      <title>NEW WAVE OF WRITING REACT-NATIVE</title>
      <dc:creator>Olabisim</dc:creator>
      <pubDate>Wed, 25 May 2022 10:43:08 +0000</pubDate>
      <link>https://dev.to/olabisim/new-wave-of-writing-react-native-11hj</link>
      <guid>https://dev.to/olabisim/new-wave-of-writing-react-native-11hj</guid>
      <description>&lt;p&gt;Doing react-native for some while is the best decision I have made. React-native comes with a lot import components to create something simple and I have found the best way for your code structure.&lt;/p&gt;

&lt;p&gt;I will start by showing a simple react native app from react-native docs and the new wave of writing react-native&lt;/p&gt;

&lt;p&gt;`import React from ‘react’;&lt;br&gt;
import { Text, View } from ‘react-native’;&lt;/p&gt;

&lt;p&gt;const YourApp = () =&amp;gt; {&lt;br&gt;
return (&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Try editing me! 🎉&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
);&lt;br&gt;
}`&lt;/p&gt;

&lt;p&gt;export default YourApp;&lt;/p&gt;

&lt;p&gt;A normal react-native developer will know you would have to write multiple view statements to keep your design and layout in sync, with multiple texts as the case maybe.&lt;/p&gt;

&lt;p&gt;As I continue to write react-native along the way I found you could simplify your code to the simplest form by using the as keyword in imports.&lt;/p&gt;

&lt;p&gt;This is a very good example from my code.&lt;br&gt;
`&lt;br&gt;
import { StyleSheet as SS, Text as T, View as V, Image as I, Dimensions as D } from ‘react-native’;&lt;/p&gt;

&lt;p&gt;import { Entypo, Ionicons, MaterialIcons } from ‘@expo/vector-icons’;&lt;/p&gt;

&lt;p&gt;const MiniCard = () =&amp;gt; {&lt;/p&gt;

&lt;p&gt;return (&lt;/p&gt;



&lt;p&gt;&amp;lt;I&lt;/p&gt;

&lt;p&gt;source={{uri: “&lt;a href="https://media.istockphoto.com/photos/teenage-girl-walking-on-sea-pier-picture-id683607708?b=1&amp;amp;k=20&amp;amp;m=683607708&amp;amp;s=170667a&amp;amp;w=0&amp;amp;h=ADhvhBmJqCAIyY5Q6Id4Lmx_XzsAXDxsvIhmlS4AtcY=%22%7D"&gt;https://media.istockphoto.com/photos/teenage-girl-walking-on-sea-pier-picture-id683607708?b=1&amp;amp;k=20&amp;amp;m=683607708&amp;amp;s=170667a&amp;amp;w=0&amp;amp;h=ADhvhBmJqCAIyY5Q6Id4Lmx_XzsAXDxsvIhmlS4AtcY="}&lt;/a&gt;}&lt;/p&gt;

&lt;p&gt;style={{&lt;/p&gt;

&lt;p&gt;width: ‘45%’,&lt;/p&gt;

&lt;p&gt;height: 100&lt;/p&gt;

&lt;p&gt;}}&lt;/p&gt;

&lt;p&gt;/&amp;gt;&lt;/p&gt;



&lt;p&gt;&amp;lt;T&lt;/p&gt;

&lt;p&gt;style={{ fontSize:17, width: D.get(“screen”).width/2}}&lt;/p&gt;

&lt;p&gt;ellipsizeMode=”tail”&lt;/p&gt;

&lt;p&gt;numberOfLines={3}&lt;/p&gt;

&lt;blockquote&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is an amazing course this is an amazing course this is an amazing course this is an amazing course this is an amazing course&lt;/p&gt;



&lt;p&gt;coders never quit&lt;/p&gt;





&lt;p&gt;)&lt;/p&gt;

&lt;p&gt;}&lt;br&gt;
export default MiniCard`&lt;/p&gt;

&lt;p&gt;Using the as keyword, I capitalized the first letter of each component as the new name.&lt;/p&gt;

&lt;p&gt;using only the first capitalized letter makes my code much more simplistic and readable, creating enough space for inline styling, component props like style and so on.&lt;/p&gt;

&lt;p&gt;I have always tried to make my code more simple as possible and neat, This is the best way so far to make your code more neat and easily readable. Being familiar with this comes with a lot of possibilities, ordinary a D means Dimensions. Instead of writing Dimensions all over again anywhere you need it, you just have to write D.&lt;/p&gt;

&lt;p&gt;As previewed, some inbuilt components starts with the same letter like ScrollView and StyleSheet, so i break them into syllables and use them as they sound, e.g scroll-view, try pronouncing that at once you will get skrrrriew, lol or whatever that may sound like, ScrollView as SV and StyleSheet as SS, that makes it much better and much simplistic because you don’t have to write much code in comparison to the normal way.&lt;/p&gt;

&lt;p&gt;I consider this new wave of writing react-native as it enhances readability, good code structure and promotes simplicity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Olabisim/youtube"&gt;https://github.com/Olabisim/youtube&lt;/a&gt; you can download my code on github to get a preview of how it looks&lt;/p&gt;

&lt;p&gt;I would love to hear your comments about this.&lt;/p&gt;

&lt;p&gt;Thank yyou.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>reactnative</category>
      <category>react</category>
      <category>android</category>
    </item>
    <item>
      <title>SETTING UP A REACT-NATIVE DESKTOP APP IN 5 MINUTES...</title>
      <dc:creator>Olabisim</dc:creator>
      <pubDate>Tue, 19 Apr 2022 22:00:26 +0000</pubDate>
      <link>https://dev.to/olabisim/setting-up-a-react-native-desktop-app-in-5-minutes-46fo</link>
      <guid>https://dev.to/olabisim/setting-up-a-react-native-desktop-app-in-5-minutes-46fo</guid>
      <description>&lt;p&gt;&lt;strong&gt;NOTE: I AM WRITING THIS BLOG BASED ON THE ISSUES I FACED BEFORE CREATING A SIMPLE REACT NATIVE DESKTOP APP&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SYSTEM REQUIREMENTS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can run React Native for Windows apps only on:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;All Windows 11 devices&lt;/li&gt;
&lt;li&gt;Windows 10 devices with Windows version: 10.0.16299.0 (aka 1709, aka Redstone 3, aka Fall Creators Update) or higher Some features may not work on all versions. See Windows 10 Compatibility for version support details.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Install the development dependencies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To check or install dependencies, run the script rnw-dependencies.ps1 (.ps1 means it is a powershell file) in an elevated PowerShell window.&lt;/p&gt;

&lt;p&gt;Run this command: Start an elevated admin PowerShell window and run:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set-ExecutionPolicy Unrestricted -Scope Process -Force;&lt;/li&gt;
&lt;li&gt;iex (New-Object System.Net.WebClient).DownloadString('&lt;a href="https://aka.ms/rnw-deps.ps1'"&gt;https://aka.ms/rnw-deps.ps1'&lt;/a&gt;)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;(run one by one)&lt;/p&gt;

&lt;p&gt;The above command will turn on developer mode and install Visual Studio, the Chocolatey package manager, and Node.js LTS version. Additionally, it’s great if your computer has a physical memory of 8GB or higher because the Windows build processes typically need above-average physical memory to run.&lt;/p&gt;

&lt;p&gt;The above script file recommends having 16GB of physical memory. You can continue with the tutorial if the second execution of the above script gives an output like below.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---93hfe4Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/opxixtulp00t1ze0wybv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---93hfe4Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/opxixtulp00t1ze0wybv.png" alt="Image description" width="880" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install React Native for Windows&lt;/strong&gt;&lt;br&gt;
Remember to call react-native init from the place you want your project directory to live.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx react-native init &amp;lt;projectName&amp;gt; --template react-native@^0.68.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Navigate into this newly created directory&lt;br&gt;
Once your project has been initialized, React Native will have created a new sub directory where all your generated files live.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd projectName&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Install the Windows extension&lt;br&gt;
Lastly, install the React Native for Windows packages.&lt;/p&gt;

&lt;p&gt;npx react-native-windows-init --overwrite&lt;/p&gt;

&lt;p&gt;The --overwrite flag copies a custom metro.config.js file. If you are starting a new app, this should have no impact. If you are adding Windows to your existing app and you have modified the metro.config.js file, please back up your changes, run the command and copy over to take effect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Running a React Native Windows App&lt;/strong&gt;&lt;br&gt;
In your React Native Windows project directory, run:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx react-native run-windows&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Did you see any error? if no you are done!!!&lt;/p&gt;

&lt;p&gt;if yes you are lucky!!!&lt;/p&gt;

&lt;p&gt;just kidding &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FIRST ERROR&lt;/strong&gt;&lt;br&gt;
After my first round of searching, I found out that I had to run a power shell file, too bad i can't find the file again!!&lt;/p&gt;

&lt;p&gt;viola!! caught you again&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/microsoft/react-native-windows/blob/main/vnext/Scripts/rnw-dependencies.ps1"&gt;https://github.com/microsoft/react-native-windows/blob/main/vnext/Scripts/rnw-dependencies.ps1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;go to the above link create a file in any directory with rnw-deps.ps1&lt;br&gt;
once done, right click on it, and run it with powershell, it takes just a sec.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SECOND ERROR&lt;/strong&gt;&lt;br&gt;
the error at line 1 char 1 positional argument, while naming my folder structure I named some folders with "DESKTOP APP" with deep searching you will find out a file "windowstoreapputils.ps1" in node modules doesn't like spaces in paths names or should I say, frustrates my life by breaking my code because of path spaces, i was able to pass through this by removing any special characters (e.g - and _ ) and spaces from my path structure.&lt;/p&gt;

&lt;p&gt;Thank you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;THIRD ERROR&lt;/strong&gt;&lt;br&gt;
My code still broke at the last part, i forgot the error but what  i did was to run&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;npm i&lt;/p&gt;

&lt;p&gt;npx react-native-windows-init --overwrite&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;multiple times then at last after a week, react-native run-windows worked fine.&lt;/p&gt;

&lt;p&gt;I am opened to any difficulty in setting up react-native desktop app!&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BeDognpM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/58gv277rngdax3zym65z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BeDognpM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/58gv277rngdax3zym65z.png" alt="Image description" width="880" height="350"&gt;&lt;/a&gt;&lt;br&gt;
how amazing it is to get this running on your system! &lt;/p&gt;

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