{"componentChunkName":"component---src-templates-blog-post-js","path":"/react-native/","result":{"data":{"site":{"siteMetadata":{"title":"Recipes Collection","author":"Internet Community"}},"markdownRemark":{"id":"863cbaae-ffea-50ac-b2a6-02f0f814b744","html":"<h2 id=\"basics\"><a href=\"#basics\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Basics</h2>\n<h4 id=\"q---explain-some-of-the-fundamental-trade-offs-between-building-with-react-native-and-building-a-true-native-app\"><a href=\"#q---explain-some-of-the-fundamental-trade-offs-between-building-with-react-native-and-building-a-true-native-app\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Q - Explain some of the fundamental trade offs between building with React Native and building a “true” native app.</h4>\n<ul>\n<li>React Native makes sense when a team is building a product that does not need <strong>extremely high performance</strong>. The limitations of the asynchronous bridge are a bottleneck for things like 3D games, and games with lots of particle updates. Apps that rely on deep interactions with low-level APIs, or need large amounts of native code, might be easier to build as native apps.</li>\n<li>React Native makes sense <strong>when an existing team is already proficient in JavaScript</strong> and/or has an existing React application built on the web or another platform. The “learn once, write everywhere” ethos advocated for by Facebook is very useful when diversifying a product across platforms.</li>\n</ul>\n<h4 id=\"q---what-is-the-relationship-between-react-native-and-react\"><a href=\"#q---what-is-the-relationship-between-react-native-and-react\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Q - What is the relationship between React Native and React?</h4>\n<ul>\n<li>React Native is built using React. React, at its core, is a library for <strong>“diffing” a virtual DOM and rendering this DOM to a screen</strong> with minimal operations. React, by default, does not have an opinion about which nodes are in its virtual DOM tree. Instead, it simply has algorithms that can determine changes in the tree and re-render. React Native implements a bridge that allows the JavaScript runtime to communicate asynchronously with the native runtime. React itself provides the tree diffing and rendering infrastructure that allows React Native to work.</li>\n<li>React on the web provides its <strong>own node primitives</strong> (<code class=\"language-text\">&lt;div&gt;, &lt;span&gt;</code>, etc), which are the building blocks for web applications. But new node primitives can be defined, as React Native has done. React Native defines its own primitives (<code class=\"language-text\">&lt;View&gt;, &lt;Image&gt;</code>, etc) which do not render HTML elements but instead map to native views, like UIView and UIImageView.</li>\n</ul>\n<hr>\n<h2 id=\"getting-started\"><a href=\"#getting-started\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Getting Started</h2>\n<h4 id=\"q---how-to-setup-react-native-for-development\"><a href=\"#q---how-to-setup-react-native-for-development\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Q - How to setup React Native for development?</h4>\n<p>You will need Node, Watchman, the React Native command line interface, and Xcode (in order to set up the necessary tooling to build your React Native app for iOS).</p>\n<ol>\n<li>\n<p>Install Node, Watchman, JDK</p>\n<p>We recommend installing Node, Watchman, and JDK using Homebrew. Run the following commands in a Terminal after installing Homebrew:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">brew install node\nbrew install watchman\nbrew tap AdoptOpenJDK/openjdk\nbrew cask install adoptopenjdk8</code></pre></div>\n<p>If you have already installed Node on your system, make sure it is Node 8.3 or newer.</p>\n<p>Watchman is a tool by Facebook for watching changes in the filesystem. It is highly recommended you install it for better performance.</p>\n<p>If you have already installed JDK on your system, make sure it is JDK 8 or newer.</p>\n</li>\n<li>\n<p>Install React Native CLI</p>\n<p>Node comes with npm, which lets you install the React Native command line interface.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">npm install -g react-native-cli</code></pre></div>\n</li>\n<li>\n<p>Install XCode</p>\n<p>The easiest way to install Xcode is via the Mac App Store. Installing Xcode will also install the iOS Simulator and all the necessary tools to build your iOS app.</p>\n<p>If you have already installed Xcode on your system, make sure it is version 9.4 or newer.</p>\n</li>\n<li>\n<p>Install XCode Command Line Tools</p>\n<p>You will also need to install the Xcode Command Line Tools. Open Xcode, then choose “Preferences…” from the Xcode menu. Go to the Locations panel and install the tools by selecting the most recent version in the Command Line Tools dropdown.</p>\n<p><img src=\"https://facebook.github.io/react-native/docs/assets/GettingStartedXcodeCommandLineTools.png\"></p>\n</li>\n</ol>\n<p>Reference - <a href=\"https://facebook.github.io/react-native/docs/getting-started\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://facebook.github.io/react-native/docs/getting-started</a></p>\n<h4 id=\"q---how-to-create-a-new-application\"><a href=\"#q---how-to-create-a-new-application\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Q - How to create a new application?</h4>\n<p>Use the React Native command line interface to generate a new React Native project called “AwesomeProject”</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">react-native init AwesomeProject</code></pre></div>\n<p>You can also use a third-party CLI to init your React Native app, such as Ignite CLI.</p>\n<p>If you want to start a new project with a specific React Native version, you can use the —version argument</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">react-native init AwesomeProject --version X.XX.X</code></pre></div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">react-native init AwesomeProject --version react-native@next</code></pre></div>\n<p>Reference - <a href=\"https://facebook.github.io/react-native/docs/getting-started\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://facebook.github.io/react-native/docs/getting-started</a></p>\n<h4 id=\"q---how-to-run-your-react-native-application\"><a href=\"#q---how-to-run-your-react-native-application\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Q - How to run your React Native application?</h4>\n<p>Run <code class=\"language-text\">react-native run-ios</code> inside your React Native project folder</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">cd AwesomeProject\nreact-native run-ios</code></pre></div>\n<p><code class=\"language-text\">react-native run-ios</code> is just one way to run your app. You can also run it directly from within Xcode.</p>\n<p>Reference - <a href=\"https://facebook.github.io/react-native/docs/getting-started\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://facebook.github.io/react-native/docs/getting-started</a></p>\n<hr>\n<h2 id=\"style\"><a href=\"#style\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Style</h2>\n<hr>\n<h2 id=\"height-and-width\"><a href=\"#height-and-width\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Height and Width</h2>\n<hr>\n<h2 id=\"handling-text-input\"><a href=\"#handling-text-input\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Handling Text Input</h2>\n<h4 id=\"q---how-to-avoid-keyboard-covering-text-inputs-in-react-native\"><a href=\"#q---how-to-avoid-keyboard-covering-text-inputs-in-react-native\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Q - How to avoid keyboard covering text inputs in React Native?</h4>\n<p><a href=\"https://codeburst.io/react-native-keyboard-covering-inputs-72a9d3072689\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://codeburst.io/react-native-keyboard-covering-inputs-72a9d3072689</a></p>\n<hr>\n<h2 id=\"handling-touches\"><a href=\"#handling-touches\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Handling Touches</h2>\n<hr>\n<h2 id=\"using-a-scrollview\"><a href=\"#using-a-scrollview\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Using a ScrollView</h2>\n<hr>\n<h2 id=\"using-list-views\"><a href=\"#using-list-views\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Using List Views</h2>\n<hr>\n<h2 id=\"networking\"><a href=\"#networking\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Networking</h2>\n<hr>\n<h2 id=\"animations\"><a href=\"#animations\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Animations</h2>\n<hr>\n<h2 id=\"accessibility\"><a href=\"#accessibility\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Accessibility</h2>\n<hr>\n<h2 id=\"timers\"><a href=\"#timers\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Timers</h2>\n<hr>\n<h2 id=\"upgrading\"><a href=\"#upgrading\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Upgrading</h2>\n<h4 id=\"q---how-to-upgrade-your-project-to-new-react-native-version\"><a href=\"#q---how-to-upgrade-your-project-to-new-react-native-version\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Q - How to upgrade your project to new React Native version?</h4>\n<p>Because typical React Native projects are essentially made up of an Android project, an iOS project, and a JavaScript project, upgrading can be rather tricky. Here’s what you need to do to upgrade from an older version of React Native.</p>\n<p><strong>Option 1</strong></p>\n<p>The React Native CLI comes with <code class=\"language-text\">upgrade</code> command that provides a one-step operation to upgrade the source files with a minimum of conflicts, thanks to the rn-diff-purge project.</p>\n<ol>\n<li>\n<p>Run the upgrade command</p>\n<p>Run the following command to start the process of upgrading to the latest version:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">react-native upgrade</code></pre></div>\n<p>You may specify a React Native version by passing an argument, e.g. to upgrade to 0.59.0-rc.0 run</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">react-native upgrade 0.59.0-rc.0</code></pre></div>\n<p>The project is upgraded using git apply with 3-way merge. That’s why it may happen you’ll need to resolve some conflicts.</p>\n</li>\n<li>\n<p>Resolve the conflicts</p>\n<p>Conflicted files include delimiters which make very clear where the changes come from. For example</p>\n<div class=\"gatsby-highlight\" data-language=\"js\"><pre class=\"language-js\"><code class=\"language-js\"> <span class=\"token number\">13</span>B07F951A680F5B00A75B9A <span class=\"token comment\">/* Release */</span> <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span>\n   isa <span class=\"token operator\">=</span> XCBuildConfiguration<span class=\"token punctuation\">;</span>\n   buildSettings <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span>\n     <span class=\"token constant\">ASSETCATALOG_COMPILER_APPICON_NAME</span> <span class=\"token operator\">=</span> AppIcon<span class=\"token punctuation\">;</span>\n <span class=\"token operator\">&lt;&lt;</span><span class=\"token operator\">&lt;&lt;</span><span class=\"token operator\">&lt;&lt;</span><span class=\"token operator\">&lt;</span> ours\n     <span class=\"token constant\">CODE_SIGN_IDENTITY</span> <span class=\"token operator\">=</span> <span class=\"token string\">\"iPhone Developer\"</span><span class=\"token punctuation\">;</span>\n     <span class=\"token constant\">FRAMEWORK_SEARCH_PATHS</span> <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span>\n       <span class=\"token string\">\"$(inherited)\"</span><span class=\"token punctuation\">,</span>\n       <span class=\"token string\">\"$(PROJECT_DIR)/HockeySDK.embeddedframework\"</span><span class=\"token punctuation\">,</span>\n       <span class=\"token string\">\"$(PROJECT_DIR)/HockeySDK-iOS/HockeySDK.embeddedframework\"</span><span class=\"token punctuation\">,</span>\n     <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n <span class=\"token operator\">===</span><span class=\"token operator\">===</span><span class=\"token operator\">=</span>\n     <span class=\"token constant\">CURRENT_PROJECT_VERSION</span> <span class=\"token operator\">=</span> <span class=\"token number\">1</span><span class=\"token punctuation\">;</span>\n <span class=\"token operator\">>>></span><span class=\"token operator\">>>></span><span class=\"token operator\">></span> theirs\n     <span class=\"token constant\">HEADER_SEARCH_PATHS</span> <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span>\n       <span class=\"token string\">\"$(inherited)\"</span><span class=\"token punctuation\">,</span>\n       <span class=\"token operator\">/</span>Applications<span class=\"token operator\">/</span>Xcode<span class=\"token punctuation\">.</span>app<span class=\"token operator\">/</span>Contents<span class=\"token operator\">/</span>Developer<span class=\"token operator\">/</span>Toolchains<span class=\"token operator\">/</span>XcodeDefault<span class=\"token punctuation\">.</span>xctoolchain<span class=\"token operator\">/</span>usr<span class=\"token operator\">/</span>include<span class=\"token punctuation\">,</span>\n       <span class=\"token string\">\"$(SRCROOT)/../node_modules/react-native/React/**\"</span><span class=\"token punctuation\">,</span>\n       <span class=\"token string\">\"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**\"</span><span class=\"token punctuation\">,</span>\n     <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>You can think of “ours” as “your team” and “theirs” as “the React Native dev team”.</p>\n</li>\n</ol>\n<p><strong>Alternative</strong></p>\n<p>Use this only in case the above didn’t work.</p>\n<ol>\n<li>\n<p>Upgrade the <code class=\"language-text\">react-native</code> dependency</p>\n<p>Note the latest version of the <code class=\"language-text\">react-native</code> npm package from here (or use <code class=\"language-text\">npm info react-native</code> to check).</p>\n<p>Now install that version of <code class=\"language-text\">react-native</code> in your project with <code class=\"language-text\">npm install --save</code></p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">$ npm install --save react-native@X.Y\n// where X.Y is the semantic version you are upgrading to\nnpm WARN peerDependencies The peer dependency react@~R included from react-native...</code></pre></div>\n<p>If you saw a warning about the peerDependency, also upgrade react by running:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">$ npm install --save react@R\n// where R is the new version of react from the peerDependency warning you saw</code></pre></div>\n</li>\n<li>\n<p>Upgrade your project templates</p>\n<p>The new npm package may contain updates to the files that are normally generated when you run <code class=\"language-text\">react-native init</code>, like the iOS and the Android sub-projects.</p>\n<p>You may consult rn-diff-purge(<a href=\"https://github.com/pvinis/rn-diff-purge\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://github.com/pvinis/rn-diff-purge</a>) to see if there were changes in the project template files. In case there weren’t any, simply rebuild the project and continue developing. In case of minor changes, you may update your project manually and rebuild.</p>\n<p>If there were major changes, run this in a terminal to get these</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">$ react-native upgrade</code></pre></div>\n<p>This will check your files against the latest template and perform the following:</p>\n<ul>\n<li>If there is a new file in the template, it is simply created.</li>\n<li>If a file in the template is identical to your file, it is skipped.</li>\n<li>If a file is different in your project than the template, you will be prompted; you have options to keep your file or overwrite it with the template version.</li>\n</ul>\n</li>\n</ol>\n<p><strong>Manual upgrade</strong></p>\n<p>If none of the above methods work, we could upgrade using manual steps. </p>\n<p>Refer React Native upgrade guide for manually upgrading.\n<a href=\"https://react-native-community.github.io/upgrade-helper/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://react-native-community.github.io/upgrade-helper/</a></p>\n<p>Reference - <a href=\"https://facebook.github.io/react-native/docs/upgrading\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://facebook.github.io/react-native/docs/upgrading</a></p>\n<h4 id=\"q---what-web-application-can-be-used-to-find-the-diff-when-upgrading\"><a href=\"#q---what-web-application-can-be-used-to-find-the-diff-when-upgrading\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Q - What web application can be used to find the diff when upgrading?</h4>\n<p>React Native upgrade guide - <a href=\"https://react-native-community.github.io/upgrade-helper/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://react-native-community.github.io/upgrade-helper/</a></p>\n<p>Reference - <a href=\"https://github.com/react-native-community/rn-diff-purge\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://github.com/react-native-community/rn-diff-purge</a></p>\n<hr>\n<h2 id=\"simulator\"><a href=\"#simulator\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Simulator</h2>\n<h4 id=\"q---how-to-fix-the-issue-of-iphone-simulator-animating-very-slowly\"><a href=\"#q---how-to-fix-the-issue-of-iphone-simulator-animating-very-slowly\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Q - How to fix the issue of iphone simulator animating very slowly?</h4>\n<ul>\n<li>Open iphone simulator</li>\n<li>Click ‘Debug’ from the menu</li>\n<li>Uncheck ‘Slow Animations’</li>\n</ul>\n<hr>\n<h2 id=\"third-party-libraries-tools\"><a href=\"#third-party-libraries-tools\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Third Party Libraries/ Tools</h2>\n<h3 id=\"mobileiron\"><a href=\"#mobileiron\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>MobileIron</h3>\n<h4 id=\"q---what-is-mobileiron\"><a href=\"#q---what-is-mobileiron\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Q - What is MobileIron?</h4>\n<ul>\n<li>MobileIron is software that companies use to secure and manage business apps, documents, and other business content on mobile phones and tablets.</li>\n<li>MobileIron software includes an administration console for the IT department and an app that employees download onto their devices from the app store or Google Play.</li>\n<li>IT uses the MobileIron console to set security and management rules.</li>\n<li>The MobileIron app provides the IT department with information about the device and its security state.</li>\n<li>This includes things like carrier, country, device make and model, operating system (OS) version, phone number, and corporate email.</li>\n</ul>\n<p>Reference - <a href=\"https://www.mobileiron.com/en/what-mobileiron\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://www.mobileiron.com/en/what-mobileiron</a></p>","timeToRead":8,"frontmatter":{"title":"React Native Notes","date":"September 02, 2019","spoiler":"Following are some notes collected through internet"},"fields":{"slug":"/react-native/","langKey":"en"}}},"pageContext":{"slug":"/react-native/","previous":{"fields":{"slug":"/security/","langKey":"en","directoryName":"security","maybeAbsoluteLinks":[]},"frontmatter":{"title":"Security Notes"}},"next":{"fields":{"slug":"/react/","langKey":"en","directoryName":"react","maybeAbsoluteLinks":[]},"frontmatter":{"title":"React Notes"}},"translations":[],"translatedLinks":[]}}}