<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pat Petillo on Medium]]></title>
        <description><![CDATA[Stories by Pat Petillo on Medium]]></description>
        <link>https://medium.com/@patpetillo?source=rss-ca9446db1415------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qSDu0yhhJigy65ITs2zFPw.jpeg</url>
            <title>Stories by Pat Petillo on Medium</title>
            <link>https://medium.com/@patpetillo?source=rss-ca9446db1415------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 19:52:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@patpetillo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[React Native Is Not (Strictly) Equal To React]]></title>
            <link>https://medium.com/@patpetillo/react-native-is-not-strictly-equal-to-react-5167940b252?source=rss-ca9446db1415------2</link>
            <guid isPermaLink="false">https://medium.com/p/5167940b252</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javscript]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Pat Petillo]]></dc:creator>
            <pubDate>Sun, 19 Nov 2017 19:57:25 GMT</pubDate>
            <atom:updated>2018-05-23T13:58:51.414Z</atom:updated>
            <content:encoded><![CDATA[<h4>...But it is pretty double equal signs</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*K1j_Ytq_bASRmiMyUKYUEw.png" /></figure><p>Bad Javascript jokes aside, I would like to share some key differences that between the Web library, React, and the mobile development framework, React Native.</p><p>Both React and React Native are rapidly growing technologies, maintained by Facebook, that are aimed at improving web development and mobile development respectively. All developers should feel quite comfortable transitioning from the declarative, component-based React web library to mobile development with React Native. They feel and perform very similarly, but there are some major differences to be aware of.</p><h3><strong>Testing Your Application</strong></h3><p>A huge upside to React is that you can launch web applications in the browser and use the browser console, as well as your terminal to debug your code. To test a React Native application you need Xcode and Android Studio to run your application on iOS and Android devices respectively. Fortunately Android Studio also provides you with emulators for various Android devices through their built-in <a href="https://developer.android.com/studio/run/managing-avds.html">Android Virtual Device</a> manager. There is also a <a href="https://facebook.github.io/react-native/docs/debugging.html">remote debugger</a> for React Native that can be launched and paired with the mobile device you are testing. However, the error stack trace is sometimes confusing and non descriptive, especially in regards to the Image require component, which I will discuss in further detail later. Be prepared for a very red phone screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/254/1*SLN7utsX0YSlaXlqrjlP0g.png" /></figure><h3>WebPack Your Bags &amp; Go</h3><p>After installing the necessary dependencies for your development operating system (macOS, Windows, or Linux) and the OS you are developing your mobile application for (iOS or Android) React Native allows you to start a new project and launch it immediately with all of the modules you need to start building an application, including a built in bundler. Simply running react-native init &lt;Project Name&gt; will create all of the necessary files and modules to create a React Native application. There is no longer a need for a bundler like Webpack to bundle the modules you need for your project (or Babel to compile your code for ES2015 browsers that do not support ES6 or ES7).</p><h3>Application Design</h3><p>If you want your application to look like a million bucks, you should be aware of the differences in styling web applications and React Native mobile applications. React Native does not use HTML or CSS, but does provide other methods for rendering and styling your components. View, Text and Image components can be used to display the equivalent of a div, p, or img tags in HTML. Wrapping all of your components in Scrollview will allow for users to scroll down the visual components or Scenes of your application. In order to add some swag to these components React Native uses stylesheets that are written in Javascript objects, which feels very friendly to a Javascript developer but very different from CSS styling.</p><pre>const styles = StyleSheet.create({<br>  container: { <br>    borderRadius: 4, <br>    borderWidth: 0.5, <br>    borderColor: ‘#d6d7da’, <br>  }, <br>  title: { <br>    fontSize: 19, <br>    fontWeight: ‘bold’, <br>  }, <br>  activeTitle: { <br>    color: ‘red’, <br>  }, <br>});</pre><p>Understanding and implementing FlexBox is also a necessary element of styling React Native components. A fun interactive tool for learning and playing around with FlexBox is <a href="http://flexboxfroggy.com/">FlexBox Froggy</a>.</p><p>One major issues I encountered personally with styling React Native components occurred when I tried to do something that is fairly common in React, dynamically rendering images by <a href="https://reactjs.org/docs/components-and-props.html">passing a prop</a> to the img src tag. Unlike React, images need to be required into React Native components and the built in React Native bundler does not support string interpolation.</p><p>For example, the following code will return an error:</p><pre>&lt;Image source={require(`./img/{ this.props.image }` /&gt;<br></pre><p>There are workarounds to this issue, and requiring a single local image is as simple as the following:</p><pre>&lt;Image source={require(‘./img/image-name.png’)} /&gt;</pre><h3>Land Ho!</h3><p>Navigating in React Native can be tricky, and there are two widely used navigation libraries, either of which should grant you the confidence to yell a resounding <em>“land ho!”</em> when you become a full fledged mobile application navigator. React Native supports a library called <a href="https://facebook.github.io/react-native/docs/navigation.html">React Navigation</a> and provides clear documentation for its use. There is a bit more of a learning curve coming from React’s well loved react-router to React Navigation, but using StackNavigator to set up components to navigate to (screen) is fairly simple. Creating onPress button actions and passing props are also extremely explicit and easy to read.</p><p>Another solution to navigation in React Native that feels a lot like React’s react-router is react-native-router-flux. In this library you use Router components to wrap Scene components that explicitly declare a component to switch to and can be triggered using an Action method within an onPress call.</p><p>Click <a href="https://medium.com/differential/react-native-basics-using-react-native-router-flux-f11e5128aff9">here</a> for a great article about using react-native-router-flux, and the <a href="https://www.npmjs.com/package/react-native-router-flux">official NPM module</a> provides a short example of its usage.</p><h3>Hello Operator</h3><p>There are differences in how your application will be displayed depending on the operating system that it is viewed on, and you should follow the appropriate guidelines for display on that operating system. React Native allows for two ways to deal with this issue. If you are as big of a fan of components and modularizing your code as I am, you will appreciate the <a href="http://facebook.github.io/react-native/releases/0.39/docs/platform-specific-code.html#platform-module">Platform Specific Code</a> module provided by React Native that uses platform-specific extensions to allow you to create different visual components for either Android or iOS. React Native then automatically loads the appropriate components for the operating system the user is using. For less complex applications you can simply check for the platform being used and display Android or iOS specific elements.</p><h3>All In All</h3><p>React Native is a truly amazing mobile development library with a ton of support. I personally had a lot of fun working with it for the first time recently when I created my first Android application after using React in many other projects. I would definitely recommend all React developers check out the mobile implementation of React.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*eNcZbCfrP_P2quUUZ6kaLA.png" /></figure><h3>About Me</h3><p>I am a Software Engineer from New York City currently studying Web Development at Fullstack Academy. I am extremely passionate about Web technology and the Web in general because of how it can connect people from all over the world. It is truly amazing to be able to share experiences, ideas, and applications with people of all different backgrounds from each and every corner of the world. The sheer awesomeness e of such a platform is often taken for granted, and I consider myself fortunate to be able to use and contribute to the Web and Web technology on a daily basis.</p><p>Thanks for reading, and feel free to reach out to me on <a href="https://www.linkedin.com/in/pat-petillo/">LinkedIn</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5167940b252" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>