<?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>Forem: vishal Raut</title>
    <description>The latest articles on Forem by vishal Raut (@vrautgit).</description>
    <link>https://forem.com/vrautgit</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%2F343156%2Fe96518b2-9861-4bb0-886a-e5576a00c8fd.png</url>
      <title>Forem: vishal Raut</title>
      <link>https://forem.com/vrautgit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/vrautgit"/>
    <language>en</language>
    <item>
      <title>React-native commands and shortcuts</title>
      <dc:creator>vishal Raut</dc:creator>
      <pubDate>Tue, 19 May 2020 08:30:14 +0000</pubDate>
      <link>https://forem.com/vrautgit/react-native-commands-and-shortcuts-58kl</link>
      <guid>https://forem.com/vrautgit/react-native-commands-and-shortcuts-58kl</guid>
      <description>&lt;h2&gt;
  
  
  Purpose of the article
&lt;/h2&gt;

&lt;p&gt;When developing an application in react-native we need to check our changes in both iOS and android platforms for simulator and emulator.&lt;br&gt;
To do that we use native tools Xcode and Android studio.&lt;br&gt;
The use of these tools might consume a lot of development time, especially if you are not a native developer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;As a solution, we can avoid using these tools until it is very necessary.&lt;br&gt;
How we can do that huh?&lt;br&gt;
Using terminal commands.&lt;br&gt;
In this article I will be sharing a commands which helps me save my development time.&lt;/p&gt;

&lt;h2&gt;
  
  
  For iOS:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Commands
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Clean build iOS build
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; cd ios
&amp;gt; Xcodebuild clean
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;List the simulators
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xcrun simctl list
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run ios build with specific simulator
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;react-native run-ios --simulator=&amp;lt;Your simulator name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Clear pod cache and install again
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; cd ios
&amp;gt; pod deintegrate
&amp;gt; rm -rf Podfile.lock 
&amp;gt; pod install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Shortcuts
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Show/hide keyboard in simulator when input field is focused
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;command + shift + k
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Clean build when from xcode
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;command + shift + k
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Start build from xcode
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;command + b
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Rotate the simulator
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;command + &amp;lt;right/left/top/bottom arrow&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Open debugging options:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;command + d
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Reloading simulator
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;command + r
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;






&lt;h2&gt;
  
  
  Android
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Commands
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;List connected devices
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adb devices
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Clean build
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; cd android
&amp;gt; ./gradlew clean
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Open debugging options
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adb shell input keyevent KEYCODE_MENU
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Open debugging options for specific device: 
Suppose emulator already open and the device is also connected then we can specify device id which will open debugging options for a specific device.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adb -s &amp;lt;Your device ID&amp;gt; shell input keyevent KEYCODE_MENU
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Connect your packager with debug build: 
Suppose you have manually installed debug build in your device and you want to connect with package
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adb reverse tcp:8081 tcp:8081
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Log device errors in debug and release mode:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adb logcat AndroidRuntime:E *:S
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Open emulator without android studio (MAC OS)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; cd ~/Library/Android/sdk/emulator
&amp;gt; ./emulator -list-avds
&amp;gt; ./emulator -avd  &amp;lt;emulator name&amp;gt;
&amp;gt; ./emulator -avd  &amp;lt;emulator name&amp;gt; -wipe-data
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run build for the specific device
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;react-native run-android deviceId=&amp;lt;DEVICE_ID&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Shortcuts
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Open debugging options on emulator
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;command + m
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Reload app on the emulator
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;r + r
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Going to back navigation
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Mac: command + delete
Windows: Cmd + Backspace
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Open app overview
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Mac: command + O
Windows: Cmd + O
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Go to home
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Mac: command + Shift + H
Windows: Cmd + Shift + H
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



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