<?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[g2i_co - Medium]]></title>
        <description><![CDATA[G2i is a hiring platform run by engineers that matches you with pre-vetted React, React Native, GraphQL, and native iOS/Android focused engineers you can trust. - Medium]]></description>
        <link>https://medium.com/g2idev?source=rss----ac27bebdb838---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>g2i_co - Medium</title>
            <link>https://medium.com/g2idev?source=rss----ac27bebdb838---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 02:35:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/g2idev" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to set up a Monorepo with React Native You.I and Yarn Workspaces]]></title>
            <link>https://medium.com/g2idev/how-to-set-up-a-monorepo-with-react-native-you-i-and-yarn-workspaces-3e83c3f08cf1?source=rss----ac27bebdb838---4</link>
            <guid isPermaLink="false">https://medium.com/p/3e83c3f08cf1</guid>
            <category><![CDATA[yarn-workspace]]></category>
            <category><![CDATA[monorepo]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Thu, 06 Feb 2020 17:38:32 GMT</pubDate>
            <atom:updated>2020-02-06T17:38:32.033Z</atom:updated>
            <content:encoded><![CDATA[<p>In order to simplify dependency management, code reuse, and collaboration across teams, many projects have sought out to use the Monorepo structure. This post will outline how to achieve a Monorepo folder structure using React Native You.I alongside Yarn Workspaces.</p><p>Things this post covers:</p><ul><li><strong>How Yarn Workspaces work.</strong></li><li><strong>The errors Metro will throw.</strong></li><li><strong>Jest Testing.</strong></li><li><strong>A Possible Alternative.</strong></li></ul><h3><strong>Goal</strong></h3><p>Our goal is to have two apps in the same repository, and allow these two apps to use the same modules inside a directory named shared . We also want to be able to run tests separately for each app.</p><pre>- apps<br>   - app_one<br>   - app_two<br>- shared<br>   - module_one<br>   - module_two</pre><p>You can go ahead and try to do this yourself, we will generate the apps using youi-tv cli , however, if you are not using React Native You.I, you can use the react-native-cli instead.</p><p>To achieve this goal we will:</p><h3><strong>Create The Repository</strong></h3><p>In the location you want to create the project, run the following commands in your terminal line to create the folders, initialize git, initialize yarn, and generate the apps.</p><ul><li><strong>Create Folders</strong></li></ul><p>mkdir monorepo</p><p>cd monorepo &amp;&amp; git init</p><p>yarn init</p><p>mkdir apps</p><p>mkdir shared</p><ul><li><strong>Generate Apps</strong></li></ul><p>cd apps &amp;&amp; youi-tv init app_one</p><p>cd apps &amp;&amp; youi-tv init app_two</p><ul><li><strong>Create Shared Modules</strong></li></ul><p>cd shared &amp;&amp; mkdir module_one &amp;&amp; cd module_one &amp;&amp; yarn init</p><p>Paste the following in your terminal to create the index.jsfile:</p><pre><br>echo &quot;import React from ‘react’;<br>import { Text } from ‘react-native’;<br>import { FormFactor } from ‘<a href="http://twitter.com/youi/react-native-youi">@youi/react-native-youi</a>’;</pre><pre>export function moduleOne() {<br> return &lt;Text&gt;{FormFactor.isTV ? “Module one for TV” : “Module one for others”}&lt;/Text&gt;;<br>}<br>&quot; &gt;&gt; shared/module_one/index.js</pre><p>cd shared &amp;&amp; mkdir module_two &amp;&amp; cd module_two &amp;&amp; yarn init</p><p>Paste the following in your terminal to create the index.jsfile:</p><pre>echo &quot;</pre><pre>export function moduleTwo() {<br> return &quot;Module Two&quot;;<br>}<br>&quot; &gt;&gt; shared/module_two/index.js</pre><p>If you are following along, you should have the following structure by now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/1*VgJLQIeS0hT9TUTLfgGL7w.png" /><figcaption>Folder Hierarchy</figcaption></figure><h3><strong>Set Up Yarn Workspaces</strong></h3><p>According to the <a href="https://yarnpkg.com/lang/en/docs/workspaces/">documentation</a> we have to add the following configuration in our <strong>package.json</strong> file:</p><pre>“workspaces”: {<br>  “packages”: [<br>     “shared/*”,<br>     “apps/app_one”,<br>     “apps/app_two”<br>   ]<br> },</pre><p>This will allow our apps to access the shared packages.</p><h3><strong>Fixing Yarn Workspaces</strong></h3><p>Once you have added the configuration, you will have to delete all of your <strong>node_modules</strong> and install them again.</p><p>Run the following command in your terminal line to find all nested <strong>node_modules, </strong>delete them, and run yarn again:</p><pre>find . -type dir -name node_modules | xargs rm -rf &amp;&amp; yarn</pre><p>Now that this is done, technically we should be able to build and start our app.</p><p>If you remember the youi-tv cli output:</p><pre>Run `youi-tv docs` to see next steps.</pre><pre>Or run the following (on platform OSX for example):</pre><pre>cd app_two</pre><pre>youi-tv build -p osx</pre><pre>./youi/build/osx/Debug/app_two</pre><p>We should be able to do that and run the app. Let&#39;s try?</p><p>In app_one build an osx app by running: youi-tv build -p osx inside apps/app_one</p><p>Then, in that same directory, run yarn start</p><p>You will see the following error:</p><pre>~/youi/monorepo/apps/app_one   master  yarn start<br>yarn run v1.19.1<br>$ node node_modules/react-native/local-cli/cli.js start<br>internal/modules/cjs/loader.js:895<br> throw err;<br> ^</pre><pre>Error: Cannot find module ‘/Users/andrei/youi/monorepo/apps/app_one/node_modules/react-native/local-cli/cli.js’<br> at Function.Module._resolveFilename (internal/modules/cjs/loader.js:892:15)<br> at Function.Module._load (internal/modules/cjs/loader.js:785:27)<br> at Function.Module.runMain (internal/modules/cjs/loader.js:1143:12)<br> at internal/main/run_main_module.js:16:11 {<br> code: ‘MODULE_NOT_FOUND’,<br> requireStack: []<br>}<br>error Command failed with exit code 1.<br>info Visit <a href="https://yarnpkg.com/en/docs/cli/run">https://yarnpkg.com/en/docs/cli/run</a> for documentation about this command.</pre><p><strong>What is happening?</strong><br>If you look inside &lt;root&gt;/apps/app_one/package.json the start script tries to call cli.js with a relative path. And since we are using workspaces, all of our dependencies were lifted up to the root of the project, therefore, they are no longer inside &lt;root&gt;/apps/app_one/node_modules , they are instead in &lt;root&gt;/node_modules .</p><p>We can fix this by using the symlink of React Native provided by yarn</p><p>Replace both start and react-native scripts with the following:</p><pre>“start”: “react-native start”,<br>“react-native”: “react-native”,</pre><p><em>Note, the </em><strong><em>react-native</em></strong><em> script here is required because when we bundle the JavaScript code, our Cmake config runs </em><strong><em>yarn react-native bundle</em></strong><em> to achieve this. If you are using just </em><strong><em>React Native </em></strong><em>omit that script.</em></p><p><strong>Does yarn start work now?</strong></p><p>Yes, it should. You can run yarn start to test it. Now since you generated the osx app, you can run it directly from the terminal line with the following command inside the app_one directory:</p><p>./youi/build/osx/debug/app_one</p><p>You will notice it attaches to the Metro packager, however, it fails with a similar message to this:</p><pre>Loading dependency graph, done. Error: Unable to resolve module `./index.youi` from `/Users/andrei/youi/monorepo/.`: The module `./index.youi` could not be found from `/Users/andrei/youi/monorepo/.`. Indeed, none of these files exist:   * `/Users/andrei/youi/monorepo/index.youi(.native||.youi.js|.native.js|.js|.youi.json|.native.json|.json|.youi.ts|.native.ts|.ts|.youi.tsx|.native.tsx|.tsx)`   * `/Users/andrei/youi/monorepo/index.youi/index(.native||.youi.js|.native.js|.js|.youi.json|.native.json|.json|.youi.ts|.native.ts|.ts|.youi.tsx|.native.tsx|.tsx)`</pre><p>It can’t find your index.youi in /Users/andrei/youi/monorepo/</p><p>This expected since index.youi.js is in app_one</p><p>To solve this we have to extend Metro’s config to also add this new root which is the apps/app_one.</p><p>Replace rn-cli.config.js in app_one for the following metro.config.js</p><p><em>Note </em><strong><em>rn-cli </em></strong><em>was deprecated in favor of </em><strong><em>metro.config</em></strong></p><pre>const blacklist = require(&#39;metro-config/src/defaults/blacklist&#39;)<br>const path = require(&#39;path&#39;);</pre><pre>module.exports = {<br>    // Add additional folders to watch that are outside app&#39;s root<br>    watchFolders: [path.resolve(__dirname, &#39;../../node_modules&#39;), path.resolve(__dirname, &#39;../../shared&#39;)],<br>    // Black list build folders to not resolve any JavaScript files in there.<br>    resolver: {<br>        blacklistRE: blacklist([/\/youi\/build\/.*/])<br>    }<br>};</pre><p>By putting this metro.config.js in app_one Metro understands the new root of the project.</p><h3><strong>Problems with hoisting</strong></h3><p>Once you have overcome the issues with the root of the project. You can try running yarn start again and connect your app. You will run into the following problem:</p><pre>Loading dependency graph, done. error: bundling failed: Error: Unable to resolve module Composition from /Users/andrei/youi/monorepo/node_modules/@youi/react-native-youi/Libraries/react-native-youi/react-native-youi-implementation.js: Module Composition does not exist in the Haste module map</pre><p>or</p><pre>Unable to resolve module `AccessibilityInfo` from `/Users/andrei/youi/monorepo/node_modules/react-native/Libraries/react-native/react-native-implementation.js`: Module `AccessibilityInfo` does not exist in the Haste module map</pre><p>The following error is related to how the workspace lifts up your dependencies to the root of your project. We can disable this feature per module by changing the configuration of the workspace as follows:</p><pre>&quot;workspaces&quot;: {<br>    &quot;nohoist&quot;: [<br>      &quot;**react-native**&quot;<br>    ],<br>      &quot;packages&quot;: [<br>      &quot;shared/*&quot;,<br>      &quot;apps/app_one&quot;,<br>      &quot;apps/app_two&quot;<br>    ]<br>  },</pre><p><em>Note — Adding &quot;</em><strong><em>**react-native**&quot;</em></strong><em> includes both </em><strong><em>react-native</em></strong><em> and the </em><strong><em>react-native-youi</em></strong><em> folder to the no hoist rule.</em></p><h3>A Working App</h3><p>And now you should be able to run your app and see it connect correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TILgMv5H0puc2ujKATuyng.png" /><figcaption>App One Running in Monorepo Project</figcaption></figure><h3><strong>Jest Testing</strong></h3><p>The last piece of the puzzle is to make sure the tests work. Let&#39;s create the following test inside app_one</p><p>You can create a file in &lt;root&gt;/apps/app_one/app.test.js with the following test:</p><pre>import React from &#39;react&#39;;<br>import { View } from &#39;react-native&#39;;<br>import { FormFactor } from &#39;<a href="http://twitter.com/youi/react-native-youi">@youi/react-native-youi</a>&#39;;</pre><pre>describe(&#39;App&#39;, () =&gt; {<br>    it(&#39;should work&#39;, () =&gt; {<br>        expect(true).toBe(true);<br>    })<br>    <br>    it(&#39;should have react-native modules&#39;, () =&gt; {<br>        expect(View).toBeTruthy();<br>    })</pre><pre>it(&#39;should have <a href="http://twitter.com/youi/rect-native-youi">@youi/rect-native-youi</a> modules&#39;, () =&gt; {<br>        expect(FormFactor).toBeTruthy();<br>    })<br>})</pre><p>Then inside app_one folder you can run:</p><p>yarn test</p><p>Output:</p><pre>✘  ~/youi/monorepo/apps/app_one   master  yarn test </pre><pre>yarn run v1.19.1<br>$ jest [ ‘/Users/andrei/youi/monorepo/apps/app_one/node_modules/react-native/’, ‘/Users/andrei/youi/monorepo/apps/app_one/node_modules/@youi/react-native-youi/’ ] FAIL ./app.test.js ● Test suite failed to run /Users/andrei/youi/monorepo/apps/app_one/node_modules/@youi/react-native-youi/jest/setup.js:328 import { WebSocket } from ‘mock-socket’; ^^^^^^ SyntaxError: Cannot use import statement outside a module at ScriptTransformer._transformAndBuildScript (../../node_modules/@jest/transform/build/ScriptTransformer.js:537:17) at ScriptTransformer.transform (../../node_modules/@jest/transform/build/ScriptTransformer.js:579:25) Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: 0.32s Ran all test suites. error Command failed with exit code 1. info Visit <a href="https://yarnpkg.com/en/docs/cli/run">https://yarnpkg.com/en/docs/cli/run</a> for documentation about this command.</pre><p>This occurs because react-native and @youi/react-native-youi ship uncompiled ES6 code. For <a href="https://jestjs.io/docs/en/configuration#transformignorepatterns-arraystring">Jest to compile</a> this code you must whitelist it in the transformIgnorePatterns option in your package.json as follows:</p><pre>“transformIgnorePatterns”: [ “/node_modules/(?!react-native|@youi)” ],</pre><p>After making this change, you can run yarn test again.</p><p>You should see the following problem:</p><pre>yarn workspace v1.19.1</pre><pre>yarn run v1.19.1</pre><pre>$ jest</pre><pre>[</pre><pre>&#39;/Users/andrei/youi/monorepo/apps/app_one/node_modules/react-native/&#39;,</pre><pre>&#39;/Users/andrei/youi/monorepo/apps/app_one/node_modules/@youi/react-native-youi/&#39;</pre><pre>]</pre><pre>FAIL  ./app.test.js</pre><pre>App</pre><pre>✕ should work (7ms)</pre><pre>● App › should work</pre><pre>Configuration error:</pre><pre>Could not locate module React mapped as:</pre><pre>/Users/andrei/youi/monorepo/apps/app_one/node_modules/react.</pre><pre>Please check your configuration for these entries:</pre><pre>{</pre><pre>&quot;moduleNameMapper&quot;: {</pre><pre>&quot;/^React$/&quot;: &quot;/Users/andrei/youi/monorepo/apps/app_one/node_modules/react&quot;</pre><pre>},</pre><pre>&quot;resolver&quot;: null</pre><pre>}</pre><pre>at createNoMappedModuleFoundError (../../node_modules/jest-resolve/build/index.js:501:17)</pre><pre>at Object.&lt;anonymous&gt; (node_modules/react-native/Libraries/Components/View/View.js:51:20)</pre><p>It is now complaining of a the moduleNameMapper configuration set by our @youi/react-native-youi preset.</p><p>There are two ways to fix this issue. One is overriding the preset configuration by making a custom preset and either pasting the preset in @youi/react-native-youi or spreading it over our JSON object. The second is also not hoisting the React package. We will choose the second option since that has been our way to go with the other modules as well.</p><p>Add React to the nohoist option:</p><pre>&quot;workspaces&quot;: {<br>    &quot;nohoist&quot;: [<br>      &quot;**react**&quot;,<br>      &quot;**react-native**&quot;<br>    ],<br>      &quot;packages&quot;: [<br>      &quot;shared/*&quot;,<br>      &quot;apps/app_one&quot;,<br>      &quot;apps/app_two&quot;<br>     ],<br> },</pre><p><strong>Result of </strong><strong>yarn test</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*ECc1WzX-UgU9eSeIFe3pgg.png" /><figcaption>yarn test</figcaption></figure><h3>Alternative</h3><p>As you can see the usage of Yarn Workspaces has proven to be quite burdensome to maintain. Overall, as your codebase progress and new updates occur, you might need to update and fix this Monorepo structure. To avoid having this kind of issue, and to also enjoy similar benefits. You could instead structure your Monorepo without symlinks created by yarn .</p><p><strong>How could we structure a </strong><strong>Monorepo without </strong><strong>Yarn Workspaces ?</strong></p><p>Under the same repository, you could have multiple independent projects linked by installing it via a relative path.</p><pre>- apps<br>   - app_one<br>   - app_two<br>- shared<br>   - module_one<br>   - module_two</pre><p>app_one and app_two can consume the shared module by installing it as follow:</p><p>yarn add file:../../shared/module_one</p><p>This will add the following to your package.json</p><pre>”module_one”: “file:../../shared/module_one”,</pre><p><em>Note, To avoid reinstalling the same dependencies make sure to declare modules as </em><em>peerDependencies inside your shared modules if you also use them.</em></p><p>This approach has the benefit of being compatible with NPM as well.</p><p><strong>Possible Problems</strong></p><p>If your shared modules have external dependencies and for some reason, you install them by running yarn inside shared/module , you have to always remember to remove the node_modules folder before running your app, else you will have name collisions.</p><h3><strong>Important Notes</strong></h3><ul><li>With Yarn Workspaces your shared packages will need to have react as a dependency.</li><li>With Yarn Workspaces your shared packages should not have react-native and @youi/react-native-youi as dependencies, this can cause collision conflicts.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e83c3f08cf1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/how-to-set-up-a-monorepo-with-react-native-you-i-and-yarn-workspaces-3e83c3f08cf1">How to set up a Monorepo with React Native You.I and Yarn Workspaces</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using You.i Engine One’s Designer Workflow to Reuse UI Components Across Mobile and TV Platforms]]></title>
            <link>https://medium.com/g2idev/using-you-i-engine-ones-designer-workflow-to-reuse-ui-components-across-mobile-and-tv-platforms-802e1272bdac?source=rss----ac27bebdb838---4</link>
            <guid isPermaLink="false">https://medium.com/p/802e1272bdac</guid>
            <category><![CDATA[cross-platform]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[youi]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Tue, 15 Oct 2019 18:52:52 GMT</pubDate>
            <atom:updated>2019-10-15T18:52:52.397Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve <a href="https://blog.g2i.co/one-react-native-video-interface-12-platforms-8af42931d294">talked before</a> about <a href="https://www.youi.tv/youi-engine/">You.i Engine One</a> saving hours of development time when building across platforms. Today, I want to talk about another use case of You.i Engine and that is leveraging component reusability on any form factor (mobile, tablet, or TV).</p><p>You.i Engine One’s Designer Workflow allows designers to create user interfaces in Adobe After Effects (AE) and then seamlessly pass off their concepts to developers. The UIs render directly to the platform through component references provided by Engine One. UIs can also be created using JSX thanks to You.i Engine’s React Native bridge.</p><p><strong>Note:</strong> the After Effects workflow has much more to it than this, and could be covered more broadly in another article (or by reading the <a href="https://developer.youi.tv/latest/Content/AE_referenceTopics/H1IntroToDesign.htm">documentation</a>). In this article, I will be focusing just on the re-use of components between form factors.</p><h3>The benefit of AE</h3><p>AE gives the designer the power to control how the UI looks in the app. The group of layers and nodes that come together to compose the UI is called a Composition.</p><p>You.i Engine allows for the designer to specify under a folder in After Effects for all the designs related to the targeted platform. For instance, all designs related to handsets are under a single folder, same for TV and tablets. There is also an option for defaults which can be reused across platforms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*uZmK05NoIA4UqjlPbgq3Bg.png" /><figcaption>Snapshot from After Effects Project structure</figcaption></figure><p>You.i Engine is configured to bundle the right assets with your project and build according to the platform. The asset locator is responsible for this. It also allows you to configure it to switch on any arbitrary factor, such as DPI, accessibility, dark mode, branding, etc.</p><p>The AE approach to design empowers the designer to be able to make changes to how the app looks without changing any code. Once the code that references a design is written, the design can change as much as it wants, as long as it does not break the contract by modifying the name and layer structure of AE.</p><p>For example, take the following trial button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XpVNFhUWuVnrT8fW14GMew.png" /></figure><p>Its tree hierarchy in the design is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*znxLVsL8_H5bzVBEDbpTJg.png" /><figcaption>Trial Button Tree Hierarchy</figcaption></figure><p>Once this design is in place and exported, it can be referenced in code and rendered to the screen.</p><p>The reference in code looks like the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bfa61a73799f82d365a8bc041dce74c6/href">https://medium.com/media/bfa61a73799f82d365a8bc041dce74c6/href</a></iframe><p>The ViewRef in this example is optional, it will not fail if you only write the ButtonRef under Composition. Following this pattern resolves ambiguity when you have multiple sibling layers with the same name. This is a common pattern with animations, for instance.</p><p>Once this reference is in place, the design team can make any changes to the design. As long as the tree structure and names of each layer are not changed, no updates are required in code.</p><h3>Reuse UI References Across Platforms</h3><p>Let’s see how we can leverage code reuse of UI references.</p><p>Despite all the visual possibilities for each platform, there is a pattern in UI compositions. Let’s imagine a sign-in screen. There are multiple ways to design this. Nevertheless, you can expect every sign-in screen to have two inputs, a forgot password button, and a sign-in button. Visually for each platform they can be very different, but structurally they can be the same.</p><p>The AE structure for a log-in screen can be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sgi652yYly_sIWzM6cXfEQ.png" /><figcaption>Login Design Tree</figcaption></figure><p>You.i After Effects plugin allows you to compose your UI out of different layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*rG0U3rddBzLNRfe1wEwMAQ.png" /><figcaption>You.i Component Categories</figcaption></figure><p>In our login design tree, Main is a Container layer, which has two Container layers as children (InputsContainer and ButtonsContainer) and a Text layer (Title). We can replicate this same tree structure for TV, handset, and tablets. However, despite following the exact same tree structure, you can layout it out as you want. Here is how this design structure could be applied to the UI on different form factors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*0hUn0xDT1-5BuLmPMs-Zdw.png" /><figcaption>Handset Log In Screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oxPwEFA0FRIS-zCXYcNvVw.png" /><figcaption>Tablet Portrait Log In Screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qDc8PCEwuSBsDCkS0TRo2Q.png" /><figcaption>TV Log In Screen</figcaption></figure><p>These skeleton UIs would serve as a starting point for the designers. The advantage is we need only one JSX component referencing these layers for all three platforms. And as long as the contract is never broken no code would need to be changed. This reduces a lot of code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfefbff12e97fd16b38699b72cad0d46/href">https://medium.com/media/dfefbff12e97fd16b38699b72cad0d46/href</a></iframe><h3>What About A Movie Lander</h3><p>Movie landers are usually composed of a hero image with a title and a large list of provided movies to watch. We could structure it as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*7kJsXmHcw3Y5ovF8UwNv5g.png" /><figcaption>Movie Lander Design Tree</figcaption></figure><p>Hero and MovieThumbnail are just container layers composed of different nodes as children.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*qa3XtJmtyG2oAEeC8TzGRg.png" /><figcaption>Hero Container Layer</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*_OpH87dcTc4yk_-v6jAm5A.png" /><figcaption>MovieThumbnail layer</figcaption></figure><p>Once we have designed this for each platform we are targeting and structure it equally, we can write a single JSX component to reference it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/356ffaee318c526e18f0fdbfe69b252e/href">https://medium.com/media/356ffaee318c526e18f0fdbfe69b252e/href</a></iframe><p>This design structure can render completely different layouts according to the platform. These differences can be made within After Effects by a production designer. Take the following as an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*P9xYN0dQibdtcU321H7FkQ.png" /><figcaption>Movies Lander on Handset</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c60-wr6-WV1_ExXJ1eLdxg.png" /><figcaption>Movies Lander on a Tablet</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-7GM6fTWagg8vffEC1kqLQ.png" /><figcaption>Movies Lander on TV</figcaption></figure><h3>Conclusion</h3><p>The main idea behind this approach is to structure your UI tree with the same names and layers. This way you can reuse the same component references. An important part of this architecture decision is to properly separate domain logic from UI. If you couple this logic it will be hard to maintain and scale your codebase. I recommend you watch <a href="https://www.youtube.com/watch?v=WpkDN78P884&amp;t=793s">Uncle Bob’s Architecture the Lost Years talk</a> and read <a href="https://blog.g2i.co/react-separation-of-concerns-78ec0545bf36">this other post I wrote</a> about the separation of concerns in React apps if you want to study this subject further.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=802e1272bdac" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/using-you-i-engine-ones-designer-workflow-to-reuse-ui-components-across-mobile-and-tv-platforms-802e1272bdac">Using You.i Engine One’s Designer Workflow to Reuse UI Components Across Mobile and TV Platforms</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[So You Want to Build a Serverless React App with Next.js and ZEIT Now]]></title>
            <link>https://medium.com/g2idev/so-you-want-to-build-a-serverless-react-app-with-next-js-and-zeit-now-be182e42e32c?source=rss----ac27bebdb838---4</link>
            <guid isPermaLink="false">https://medium.com/p/be182e42e32c</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[zeit]]></category>
            <dc:creator><![CDATA[Adrian Carolli]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 22:04:50 GMT</pubDate>
            <atom:updated>2019-08-14T22:04:50.222Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*seGiGz1r96bFLi6rkShfCA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/klWUhr-wPJ8?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">imgix</a> on <a href="https://unsplash.com/search/photos/data-center?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Let’s say you’re starting your next project, its often overlooked but deployment is something you should be thinking about as early as possible. In today’s day and age serverless is a great option and one you should consider. In this article, we will discuss the pros and cons of serverless then we will quickly build a React app using Next.js and deploy it with ZEIT Now.</p><h3>Overview</h3><p>1. Introduction<br>2. Setup Next.js<br>3. Setup ZEIT Now<br>4. Conclusion<br>5. Where to learn more?</p><h3>1 — Introduction</h3><p>If you have heard of the phrase “focus on your business logic” — you already understand the benefits of serverless. <strong>Most developers who try serverless have a relatively stress-free experience but some do not and are left frustrated (keep reading the introduction</strong>👇<strong>)</strong>. In fact, building a web or mobile app is easier than ever before and serverless is making it even easier but it doesn’t work for everyone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*5hfwXrzbQvSFYY_dDPWIAA.gif" /><figcaption>Serverless — focus on your business logic!</figcaption></figure><p>To start, let’s realize and agree that “serverless” is kind of a poor name for its definition. Serverless still involves servers, you just don’t manage them. What we used to call front-end driven apps, gets labeled “serverless”. When we talk about “The Stack,” we no longer talk about operating systems, specific web servers, backend programming languages, or databases because the front-end is becoming more powerful. We can build front-end applications now without the pain of owning infrastructure — this is mainly what serverless is about. If you are interested, you can read more about the general idea <a href="https://jamstack.org/">here</a>.</p><h4>Pros and Cons</h4><p>So, why or why not choose serverless? Well, you’re in luck because I built my side project (<a href="https://reactanywhere.co/">reactanywhere.co</a>) using serverless to discover the pros and cons. In fact, side projects are a perfect use-case to try out serverless technologies which I highly recommend.</p><p><strong>It’s important to recognize that I’m not recommending that you use serverless for every app you build.</strong> Why? Like most things serverless has some drawbacks and limitations which you need to understand before you commit to it.</p><p>Let’s talk about why you would want to use serverless infrastructure:</p><ul><li>You’re a <strong>front-end developer</strong> (like me! <a href="https://emojipedia.org/waving-hand-sign/">👋</a>) who wants to focus on the front-end</li><li>You’re an <strong>entrepreneur</strong> (like me!) who wants to focus on customer value, business logic and testing your idea quickly</li><li>You don’t want to deal with server infrastructure (like me!) and invest your <strong>time and money</strong> into server “stuff”</li><li>You’re building <strong>a</strong> <strong>side-project</strong> (like me!) or a startup where you’re learning a lot and need to test something new</li><li>You’re building <strong>a</strong> <strong>simple app</strong> (like me!) that doesn’t involve long running threads</li><li>You’re <strong>rapidly prototyping</strong> something (like me!) that is intended to be experimental and the code will likely be rewritten</li><li>You’re <strong>a small team</strong> (like me!) who can’t afford hiring a lot of people</li><li>You like getting things for <strong>free</strong> (like me!) such as global deployments, maintenance and scaling</li><li>And generally you want to focus on the <strong>front-end</strong> (like me!)</li></ul><p>Now, let’s talk about why you wouldn’t want to use serverless infrastructure:</p><ul><li>You’re building a complicated app with long running threads (i.e. artificial intelligence, image processing, etc.) or might need this in the future</li><li>You can’t afford to take any risks on cutting-edge technologies</li><li>You already have a backend and or server team within your organization that can help</li><li>Most members of your company have never tried serverless</li><li>You don’t like being locked into things like vendors</li><li>You don’t fantasize that all back-end and server engineers move out of your way</li><li>You don’t like new technology</li><li>You don’t like troubleshooting things you don’t fully understand</li><li>You like full control over everything and want to understand how everything works</li></ul><p>So, that’s a lot to think about before you jump into serverless infrastructure! I highly recommend that you take these things into serious consideration. Generally, I think serverless works really well for well-defined use cases, scrappy startups, front-end engineers, and or side-projects. If one or more of those describes you then serverless <strong>might</strong> make sense, and you can throw away your server infrastructure (see the GIF below). However, if serverless does not work for your use-case it will be very frustrating.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*60jL70q0jvX04YMZ28l3EA.gif" /><figcaption>Serverless-throw away your server infrastructure!</figcaption></figure><h4>Benefit and Cost</h4><p>Unfortunately, its not always clear whether serverless is going to work for your use-case until you go down the rabbit hole. <a href="https://twitter.com/kentcdodds">Kent C. Dodds</a> <a href="https://youtu.be/tO8qHlr6Wqg?t=370">says</a> it well:</p><blockquote>Be mindful of your abstraction. The universal truth is that the better you understand your abstraction, the more effective you will be at using it. Every abstraction has a cost.</blockquote><p>So, you must ask yourself two very important questions: What is the benefit of this abstraction? And what is the cost of this abstraction? Until you understand those questions serverless may or may not be beneficial for your use-case. However, it’s kind of a paradox because you need to use serverless to be able to understand its cost and benefit (but hopefully I can help).</p><p>Let’s try to understand the benefits of serverless:</p><ul><li>None to little server infrastructure</li><li>No maintenance</li><li>No server or dev-ops team</li><li>Global deployments and scaling for free</li><li>You rarely work with your server infrastructure</li></ul><p>Now, let’s understand the costs of serverless:</p><ul><li>Vendor dependent</li><li>When the server doesn’t work its hard to understand why its not working</li><li>Limited to its capabilities</li><li>You rarely work with your server infrastructure and so you don’t get time to fully understand it</li></ul><p>Aha! Once again we are left with unclear choices. Therefore, there is no universal answer to whether serverless is going to work for your use-case. It’s going to be based on a case by case basis. Although, my general advice is to try it on a side-project like I did to better understand the “serverless abstraction”!</p><h3>2 — Setup Next.js</h3><p>If you got this far you read the introduction and are ready to try building a serverless <a href="https://reactjs.org/">React</a> app. You understand the pros and cons of serverless as well as the benefits and costs of it. If not, you should go back and read the introduction because it’s the main value of this blog post. Also, if at any point you get lost, I have setup a Github <a href="https://github.com/watadarkstar/article-serverless-zeit">repository</a> with my code.</p><p>Okay enough talk, let’s get your serverless React app setup. The prerequisite to this is that you have <a href="https://www.npmjs.com/get-npm">npm</a> installed.</p><h4>Step 1</h4><p>First things first, make a directory in a terminal for all your code. For this example we will call it article-serverless-zeit:</p><pre>mkdir article-serverless-zeit<br>cd article-serverless-zeit</pre><h4>Step 2</h4><p>Next (pun intended) we initialize an npm project like so:</p><pre>npm init -y</pre><h4>Step 3</h4><p>And install React and <a href="https://nextjs.org/">Next.js</a>:</p><pre>npm install --save next react react-dom</pre><h4>Step 4</h4><p>Add a script to your package.json like this:</p><pre>{<br>  <strong>&quot;scripts&quot;</strong>: {<br>    <strong>&quot;dev&quot;</strong>: &quot;next&quot;,<br>    <strong>&quot;build&quot;</strong>: &quot;next build&quot;,<br>    <strong>&quot;start&quot;</strong>: &quot;next start&quot;<br>  }<br>}</pre><h4>Step 5</h4><p>After that, the file-system is the main API. Every .js file becomes a route that gets automatically processed and rendered.</p><p>So, create a file called ./pages/index.js inside your project and populate it with the following content:</p><pre><strong>function</strong> Home() {<br>  <strong>return</strong> &lt;div&gt;Welcome to Next.js!&lt;/div&gt;;<br>}</pre><pre><strong>export</strong> <strong>default</strong> Home;</pre><p>And then simply run npm run dev and go to <a href="http://localhost:3000.">http://localhost:3000.</a> Wow that was easy!</p><h3>3 — Setup ZEIT Now</h3><p>Next, let’s deploy the React app using <a href="https://zeit.co/now">ZEIT Now</a> which makes deploying serverless apps easy.</p><h4>Step 1</h4><p>Firstly, install the now CLI with npm:</p><pre>npm i -g now</pre><h4>Step 2</h4><p>Once finished login like so (if you don’t have an account create one <a href="https://zeit.co/signup">here</a>):</p><pre>now login</pre><h4>Step 3</h4><p>Create a file called ./next.config.js to use as our entry point for the build, and to configure that the build should be a collection of serverless <a href="https://zeit.co/docs/v2/deployments/concepts/lambdas/">lambdas</a>:</p><pre>module.exports = {<br>  target: &#39;serverless&#39;<br>}</pre><h4>Step 4</h4><p>Then define a build step in a ./now.json configuration file:</p><pre>{<br>  <strong>&quot;version&quot;</strong>: 2,<br>  <strong>&quot;builds&quot;</strong>: [{ <strong>&quot;src&quot;</strong>: &quot;next.config.js&quot;, <strong>&quot;use&quot;</strong>: &quot;@now/next&quot; }]<br>}</pre><h4>Step 5</h4><p>Its recommended to add a .nowignore to avoid issues and make uploading faster:</p><pre>.next<br>node_modules</pre><h4>Step 6</h4><p>And finally we can deploy! Like so:</p><pre>now</pre><p>Once that finishes you will get a link in your terminal (like <a href="https://article-serverless-zeit.adriancaarolli.now.sh/">this one</a>) and that’s it. Wow that was the easiest deployment ever!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*M7PN_K_X5DLnwduDmqCU2g.gif" /></figure><h3>4 — Conclusion</h3><p>I hope this guide helped you decide whether serverless is right for you and helped you setup your serverless React app. If you would like to go further I encourage you to read the <a href="https://nextjs.org/docs">Next.js</a> and ZEIT <a href="https://zeit.co/docs">Now</a> documentation.</p><h3>5 — Who to ask for help</h3><ul><li>If you have any questions about ZEIT Now and Next.js, post your question in the ZEIT <a href="https://zeit.co/chat">chat</a> community.</li><li>Lastly, give me a follow on <a href="https://twitter.com/icookandcode">Twitter</a> and tweet or DM me any questions. I tend to be very active on Twitter.</li></ul><p>Looking forward to more articles about serverless? Follow our guest blogger Adrian Carolli on <a href="https://twitter.com/icookandcode">Twitter</a> to keep updated. He works as a React developer at <a href="https://www.g2i.co/">G2i</a>, a hiring platform run by engineers that matches you with pre-vetted React, React Native, GraphQL, and native iOS/Android focused engineers you can trust.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be182e42e32c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/so-you-want-to-build-a-serverless-react-app-with-next-js-and-zeit-now-be182e42e32c">So You Want to Build a Serverless React App with Next.js and ZEIT Now</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React — Separation of Concerns]]></title>
            <link>https://medium.com/g2idev/react-separation-of-concerns-78ec0545bf36?source=rss----ac27bebdb838---4</link>
            <guid isPermaLink="false">https://medium.com/p/78ec0545bf36</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[mobx]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Tue, 06 Aug 2019 18:24:46 GMT</pubDate>
            <atom:updated>2019-08-07T12:23:27.598Z</atom:updated>
            <content:encoded><![CDATA[<h3>React — Separation of Concerns</h3><blockquote>When specifying the behavior of a data structure component, there are often two concerns that need to be dealt with: basic functionality and support for data integrity. A data structure component is often easier to use if these two concerns are divided as much as possible into separate sets of client functions.²</blockquote><h3>Data Colocation</h3><p>Data colocation has been part of React since the beginning. From the early days until now, Component State has always been a way to colocate data with components. GraphQL Clients also pushed on this idea, Relay, for example, has a Fragment Container plus data masking approach, each component can declare its data requirements and only receive what it required. Data masking will hide data required from other child fragments.</p><p>Despite these tendencies, Redux and Mobx moved towards a separate idea. Domain logic separation from components. Make the components as dumb as possible which essentially meant not having any Domain fetching logic in it.</p><p>One can comment that GraphQL Client like Relay, also achieves separation of concerns. It abstracted the network requests and you essentially only declare your data needs through a selector, in Relay&#39;s case a GraphQL Query. Also, its mutation commit API is not tied to injected props. Apollo has less separation, mutations are expected to be done inside the Components and their FaCC¹ approach also enforces this.</p><h3><strong>Client Software</strong></h3><p>There are two relevant parts to every Client Software. A User Interface and the Domain Logic. The former is everything you interact with, the modal, screen, and tooltip. The latter represents everything related to your business. The data you are fetching and normalizing about the User or Friends are part of your domain logic. The validation of user input is a domain logic, however, the state you hold that decides that the input should be red because it is wrong is a UI logic.</p><p>Separation of concerns is an important principle of Software Engineering. There are enough posts which argument this point. See <a href="https://softwareengineering.stackexchange.com/a/32614">this StackExchange answer</a> which gives a practical example of the benefits.</p><h3>Separating Concerns</h3><p>If the goal is to separate than let&#39;s review the available approaches. Imagine we represent each layer with the following color:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*KP-vlEDv8cyhr__DlACGlw.png" /></figure><p>By using just React. You are essentially holding State at the same layer you are rendering. A very common approach is to fetch user information on the first render and store this data locally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*UewrzB44_Fj9NQoJMWRwLA.png" /></figure><p>The above approach mixes Domain logic with UI Logic. Any changes to Domain logic would require direct changes to the UI logic, exposing the UI to possible regression bugs. There is however a way to avoid this. Which would be by Containerizing the domain logic, thus, wrapping your UI components with stateful Components. Giving us then the following representation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*F3_cNBMchus-cgyA5n9svg.png" /></figure><p>Container versus Presentational approach has been largely discussed by the community. However, there seems to be a misunderstanding of the current changes made by React. By adding hooks, the community interpreted that React Applications should now keep Domain logic inside the components, next to the UI logic. This misunderstanding can be evidenced by this tweet:</p><h3>Islam Attrash on Twitter</h3><p>Something confuse me with #React #Hooks. I hope that I find someone that elaborate on this</p><p>David K. also mentions his observation of how React currently encourages Domain logic coupling with UI logic.</p><h3>David K. 🎹 on Twitter</h3><p>💡 Model and develop your app&#39;s logic as if it will be used in many different UIs (e.g., web, CLI, native, etc.), even if it won&#39;t be. This will force you to avoid coupling logic with presentation, which mainstream frameworks (React, Angular, Vue) unintentionally encourage.</p><p>The addition of hooks did not prohibit the Container approach. Matter of fact, Hooks did not add any new functionality to React. It only changed the API Surface.</p><h3>Leaking Logic</h3><blockquote>The problem is not the approach. But rather the lack of understanding where the line crosses.</blockquote><p>The problem is not the approach. But rather the lack of understanding where the line crosses. Most approaches either directly leak Domain logic into the UI or allow you to do so. Composing the following structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*oA89dCB4wIjsJmNMGivleQ.png" /></figure><p>Here we have Domain Logic leaked inside the UI and also inverse direction — UI logic leaked into the Domain. What are examples of leaked logic?</p><p><strong>By Injecting Props</strong></p><p>Imagine the following: One can have some data about the result of a quiz. The goal is to render the right and wrong questions. By checking the right and wrong questions inside the UI rendering logic you are leaking your Domain logic. Your UI should only worry about rendering, not validating the data.</p><p>Although Redux provides ways to avoid the direct use of dispatch inside your component. Directly calling dispatch inside your UI layer, you are essentially leaking your Domain logic. Instead of calling <em>dispatch(getUser(payload))</em>, the UI should only worry about a <em>getUser </em>function. Better yet would be if your UI only worried about User data.</p><p>GraphQL Clients like Apollo and Relay both leak Domain logic into the UI layer. Relay, injects a relay prop which allows you to directly call relay functions. Apollo, injects a client prop with similar features. There are alternatives to avoid this leak, nonetheless, the existence of it makes most implementation naturally leak the logic.</p><p><strong>By Lifting State</strong></p><p>The inverse leak — lifting up logic to a domain container from the UI layer. The separation of concerns can confuse Developers. Separating Domain logic form UI does not mean UI does not have any state. State related to a View should be inside the View.</p><h3>More</h3><p>When following Software Development principles, many overlap with the separation of concerns. The goal is to achieve a scalable and maintainable codebase. The fact is we want to change code, add features, and feel confident of the work we have done. Needless to say that software is the result of a very flexible composition of written syntax. It allows you to write it any way you like. Therefore, there won&#39;t be a right or wrong case. But rather a suggestive path you can take.</p><p>If you want to dig more into this topic, I suggest you read <a href="https://michel.codes/blogs/ui-as-an-afterthought">Michel Westrate UI as an afterthought post</a>. Also, follow <a href="https://twitter.com/DavidKPiano">David K.</a> who occasionally tweets about State Machines.</p><p><strong>Footnotes</strong></p><p>[1] FaCC — Function as Child Component. Commonly called Render Props.</p><p>[2] Principles of Software Engineering. In University of Minnesota Duluth site. Retrieved August 3, 2019, from <a href="https://www.d.umn.edu/~gshute/softeng/principles.html">https://www.d.umn.edu/~gshute/softeng/principles.html</a></p><p>[3] UI as an afterthought. In Michel Codes. Retrieved August 3, 2019, from <a href="https://michel.codes/blogs/ui-as-an-afterthought">https://michel.codes/blogs/ui-as-an-afterthought</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78ec0545bf36" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/react-separation-of-concerns-78ec0545bf36">React — Separation of Concerns</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding The Right Cultural Fit in G2i]]></title>
            <link>https://medium.com/g2idev/finding-the-right-cultural-fit-in-g2i-864c80536b5d?source=rss----ac27bebdb838---4</link>
            <guid isPermaLink="false">https://medium.com/p/864c80536b5d</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[staffing-and-recruiting]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Fernando Gonzalez]]></dc:creator>
            <pubDate>Tue, 30 Jul 2019 19:53:52 GMT</pubDate>
            <atom:updated>2019-07-30T19:53:52.423Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*Ba56G3uiwWXjC7fCMoVyYA.jpeg" /></figure><p>When looking to bring on external development resources to your existing team, it’s safe to say that technical ability is the number one criteria. As it should be. Yet, an aspect which is often overlooked is culture. How well can a third-party team integrate with your existing org structure? Do they gel well with the rest of the staff? Do they improve productivity or decrease it? The fact is, most contractors have pre-vetted engineers with more than enough development skills to get the job done. Only some have the culture to help you unlock innovative technology.</p><p>We’re all chasing game-changing tech. If you want to find it, you need the right dev shop culture.</p><p>At <a href="https://www.youi.tv/">You.i TV</a>, we found G2i.</p><p>You.i TV is the company behind <a href="https://www.youi.tv/youi-engine/">You.i Engine One</a>, a cross-platform development kit which enables engineering teams to deliver video apps across mobile, tablet, game consoles, streaming devices, set-top boxes, and Smart TVs from a single codebase. Two years ago, we added support for React Native as a development framework, which is why we brought on G2i to help build a React Native app across Android mobile, tablet, and TV devices.</p><p>We were drawn to G2i because of their robust vetting process and expertise in React, React Native, GraphQL, Node.js, and Android/iOS development.</p><p>But even with their great track record, G2i was venturing into uncharted waters. G2i had never built a streaming app before — and speaking from personal experience, it’s a challenging project, especially with TV-connected devices. React Native is very a comfortable solution for mobile but building streaming video apps for TV interfaces is difficult.</p><p>Luckily, G2i dove in head first. Even though this was a project first, G2i had a strong sense of ownership in the work being done. They wanted to be involved every step of the way and were committed to the quality of the product delivered. They would ask questions, recognize when others needed help, and step in to pick up any slack. They weren’t interested in coming to work and waiting to be assigned tasks for the day. Instead, they were creative in their approach and took on the challenges that followed.</p><p>G2i’s ownership made it easy for them to build relationships with us during the project. They threw themselves into all our communication channels and quickly became collaborative with the React Native team. This made communication much more fluid, allowing them to adapt throughout an innovative project with a big, and relatively unknown learning curve.</p><p>G2i was only brought on to help with development work but they took a shining to our technology. So much so that they wrote a couple of <a href="https://www.youi.tv/one-react-native-video-interface-12-platforms/">blog posts</a> about their experience working with our tech which made our Marketing team very, very happy.</p><p>Without the right culture, there isn’t enough tech knowledge in the world that can help you break through those innovation barriers. Never having built a streaming video app before, G2i’s technical expertise wasn’t the difference maker, their passion, ownership, and adaptability were. These intangibles are easy to overlook, but in our experience, they were far more important than technical ability to the quality of our ROI.</p><p>So when hunting for a dev shop, take a page from our book. Look at culture first, tech second. You’ll be glad you did.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=864c80536b5d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/finding-the-right-cultural-fit-in-g2i-864c80536b5d">Finding The Right Cultural Fit in G2i</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Helping frontend / React engineers prepare for interviews with mock interviews]]></title>
            <link>https://medium.com/g2idev/helping-frontend-react-engineers-prepare-for-interviews-with-mock-interviews-3ca7e98982f?source=rss----ac27bebdb838---4</link>
            <guid isPermaLink="false">https://medium.com/p/3ca7e98982f</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[frontend]]></category>
            <dc:creator><![CDATA[J.C. Hiatt]]></dc:creator>
            <pubDate>Tue, 28 May 2019 16:10:02 GMT</pubDate>
            <atom:updated>2019-05-28T16:10:02.176Z</atom:updated>
            <content:encoded><![CDATA[<h3>Helping Frontend Engineers Prepare For Interviews, With Mock Interviews</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UDlZuDgKltZzyzolfoEQGQ.jpeg" /></figure><p>A couple of months ago, I was hunting for a new job. I found myself going through lots of interviews and stressing a lot over preparing for them.</p><p>I’ve found interviews to be highly subjective to the company — you never really know what the company values or what hills they are going to die on until you actually are in the middle of an interview with them.</p><p>One company refers to you as a “Senior Frontend Engineer” and another says you’re a junior to them because you only know a certain framework like React or Vue but nothing about the underlying JavaScript that drives those frameworks. One company thinks CSS isn’t important because you can just use Bootstrap, and another company thinks if you can’t write your own CSS framework then you are doomed to be labeled a junior forever at their company.</p><p>Interviewers may care deeply that you can explain what closure is, and others may not even know what closure is themselves.</p><p>Fortunately, despite the subjectivity of these interviews, I went through enough to start to identify what I think are key pieces of information that companies want you to know, at least to land a frontend engineer role (specifically React-oriented since that’s what I know best), and how deeply they want you to know these things at the Junior, Mid, and Senior levels.</p><p>Being in the middle of preparing for these interviews, I realized that I also always learn better when I teach. So I decided to start doing a couple of mock interviews per month for people looking for a frontend position. I announced it with a tweet here:</p><h3>J.C. Hiatt ❁ on Twitter</h3><p>Interviewing for a frontend position? I am volunteering two 30-minute sessions per month to help anyone out with a mock interview. I&#39;ll ask you frontend questions related to the level you&#39;re applying for. Removing pressure can be really helpful! Apply: https://t.co/Qj5wrCdNMG https://t.co/e8yMpt7wst</p><p>The first person I helped was Erin Fox, who enjoyed it so much she left an amazing review!</p><h3>Erin Fox on Twitter</h3><p>This was by far, THE BEST interview help I have ever had. @jchiatt explains concepts so well and I learned the best way to answer JS frontend questions for an interview. 100% would recommend signing up before he&#39;s booked! https://t.co/4X3N4PzC6a</p><p>Since this initial interview, dozens of people have applied to get a slot! It’s been really fun so far!</p><p>I was approached by <a href="https://g2i.co/">G2i</a> recently, who asked if they could sponsor my efforts in this! I’m so excited to announce that I am now able to do four of these per month because of their generosity! I love that they are so committed to helping the community by giving back in ways like this. They are especially wanting me to extend this help to underrepresented groups in tech.</p><p>G2i is a hiring platform focused on matching you with vetted engineers from the React, React Native, and native iOS/Android communities. They can help match you with remote engineers either full-time or contract. If you don’t have a team, they can also architect and build your application themselves.</p><h3>J.C. Hiatt ❁ on Twitter</h3><p>🔈 HUGE NEWS! So excited to announce that @g2i_co is sponsoring my efforts in helping devs prep for interviews! And I&#39;m doubling to *4* per month! Anyone is welcome to apply, but they would like to especially extend this to underrepresented groups! Apply: https://t.co/8r938KjoUZ https://t.co/gtGF0EIdgK</p><h3>How it works</h3><p>First, you’ll <a href="https://t.co/Qj5wrCdNMG">apply by answering a few quick questions</a>. Anyone who is looking for a frontend role (of any skill level) is welcome to apply, but keep in mind that at this time the only framework-specific questions I may ask are React-specific. All other questions are about regular ‘ol HTML, CSS, and JavaScript.</p><p>If you are selected to be one of the four interviews I do each month, you’ll get an email from me with a link to book a time that works for you!</p><p>Be sure to study up, and we’ll get together for about 45 minutes and go through the interview. Each interview is 10–20 technical questions and there is absolutely no pressure from me (I can even help you along if you’re getting stuck somewhere). Sometimes it can help to take the pressure out of the situation so you can find out for yourself just how much you really know — this can translate into more confidence when you’re in a <em>real</em> interview!</p><h3>Let’s go!</h3><p>To get started, please <a href="https://jchiatt.typeform.com/to/uuXmxI">fill out my application form</a>. Maybe we’ll chat soon!</p><p>And a HUGE thanks again to <a href="http://g2i.co/">G2i</a> for sponsoring this effort!</p><p>J.C. Hiatt is Software Engineer &amp; Growth Manager at <a href="https://echobind.com/">Echobind</a>, where he helps build awesome applications with JavaScript, React, React Native, and GraphQL and grow the community through education and training. He is also the founder of <a href="https://devlifts.io/">DevLifts</a>, a developer-centric fitness company focused on helping developers live healthier lives. He’s an <a href="https://egghead.io/instructors/jc-hiatt">Egghead instructor</a>, an organizer of multiple meetups, and the organizer of the annual <a href="https://magnoliajs.com/">MagnoliaJS conference</a> held in Jackson, Mississippi. In his spare time, you’ll find him with his wife and dog. He is also a <a href="https://www.challies.com/articles/what-it-means-to-be-reformed/">Reformed</a> member of the Christian faith and is active in his local church. You can <a href="https://jchiatt.com/">check his website out here</a> or <a href="https://twitter.com/jchiatt">follow him on Twitter here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ca7e98982f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/helping-frontend-react-engineers-prepare-for-interviews-with-mock-interviews-3ca7e98982f">Helping frontend / React engineers prepare for interviews with mock interviews</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Telling a Story with Your Code]]></title>
            <link>https://medium.com/g2idev/telling-a-story-with-your-code-54cf17a0d336?source=rss----ac27bebdb838---4</link>
            <guid isPermaLink="false">https://medium.com/p/54cf17a0d336</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Latisha McNeel]]></dc:creator>
            <pubDate>Tue, 23 Apr 2019 19:51:35 GMT</pubDate>
            <atom:updated>2019-04-23T19:51:34.876Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ecPlIKTAXl_Dq7ikatdKOg.png" /></figure><p>Written in conjunction with a live chat hosted by <a href="https://twitter.com/powertofly">@PowerToFly</a> and sponsored by <a href="https://twitter.com/g2i_co">@G2i_co</a>.</p><p><a href="https://powertofly.com/career/live-chats/91081?utm_source=social&amp;utm_medium=cpa&amp;utm_campaign=ChatAndLearn&amp;utm_content=G2i">Telling a Story with Your Code</a></p><p><a href="https://github.com/lmcneel/telling-a-story-with-your-code">Github Examples: Telling a Story with Your Code</a></p><p>A story is an accounting of a set of events or people, real or imaginary. Code is either a system of words, letters or figures substituted for other words, letters or figures, especially for the purposes of secrecy or programming instructions. Sometimes, while reading code (computer science), both definitions apply. In the talk about inclusivity, everyone, all humans, should be able to use the applications or products we build. If we are building for everyone, why then are we writing code like we only want those with our decoder ring to be collaborators? Or we only want the computer to be able to decode what we wrote?</p><p>Whether we are writing a novel, a short story, an article or code, our audience is always our fellow humans. The computer can interpret the statements whether we use the most concise way of writing an algorithm or whether we use the most readable way. Sometimes we will care about the optimization of a line. We will need the line to be faster. What we always care about is whether or not we can understand what the line is doing when we read it. Having to guess about what a line of code is doing fuels the imposter syndrome that so many of us fight with.</p><p>For the most part, we build our applications with high-level programming languages. Programming languages that are meant for humans to be able to understand and must be compiled or interpreted for computers to understand. If we are writing in a language that will be translated for the computer, why are we still writing code that requires so much translation for humans as well?</p><h3>What is telling a story with your code?</h3><p>Some people think programming is science and math with rules and formulas. Others think programming is an art. The computer will see code in black and white, right or wrong, on or off — two choices. Humans will read code and will read it subjectively, the same way they read a news article or Shakespeare. Art is subjective, and because we are critics, we tend to stereotype art as without rules whereas, with science, we want to be methodical, follow a formula, prove something “right.” Even then, science and art are not all that far apart. Architecture both uses math and science, and yet, we call buildings beautiful. We try to find new ways to combine the rules into more beautiful structures. Art uses science when combining two colors to make a new color and has rules for composition. Programming is also both science and art, and writing code is still a form of writing.</p><h3>Where do I start telling the story?</h3><p>The story starts with the architecture and the folder structure. Uncle Bob says that “good architectures scream their intended usage.” A portion of the architecture is the folder structure and naming the folder structure. On naming things, Uncle Bob states that “choosing names in programming is as important as naming your children.”</p><p>On that, a programmer needs to know the business and have good communication with the stakeholders. The group needs to decide on a taxonomy. If the naming of things is based on the terminology in the business, then the programmer can talk to the stakeholders and discuss the code with more clarity. Remember, changing the names of things in code is usually a cheap operation. A good coding editor does most of the work for you. Knowing everything about the business on day one is not necessary.</p><p>In naming the nouns and verbs of programming, we start with the taxonomy of the domain or business. We may use a thesaurus to find a better word for a word that doesn’t seem specific enough. We may question the same word being used in different ways. This leads to a comparison of DRY principles in writing a novel and in writing code.</p><p>In writing a novel, I use a thesaurus to vary my word choice and see if I can find a more descriptive word when I realize I used the word “walking” 20 times and maybe “strolling,” or “running” was a better choice. In programming, DRY means I don’t want to write the same block of code multiple times — I don’t want to have to maintain code that does the same thing more than once. In programming, I absolutely want to use the same word to describe the same thing every single time. I want consistency with word choice.</p><h3>What is an example of telling a story with code?</h3><p>Look at the following two code samples:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ee05d40e5020901d37608c1a14ee412/href">https://medium.com/media/7ee05d40e5020901d37608c1a14ee412/href</a></iframe><p>It is only a couple of object declarations — a character, in a game, in a story — we don’t know. But there are some differences. Is the general character better than myCharacter? I think so. Ultimately, this may not be my character — it might just be a character in a game I build with other developers. The prefix my is extra — Grammarly tells me I use extra words when writing all the time.</p><p>The other difference is a property declaration — one is isMovingand the other is just move. Does the extra word make a difference in the readability, in the story here? The first one tells me that the character named Latisha is moving. We don’t know much else, but we know that Latisha is moving. The second one just says move:true. That leads to more questions. Is Latisha moving, does she have the ability to move? Is move a verb or a noun in the property? We don’t know — we can make assumptions, but the line is open to interpretation.</p><p>We don’t know if the character has the ability to move — as in walk, fly or run OR if the character, should actually be a user, and is moving houses or apartments. How many stories can be invented with just the above samples? How could we change the details to allow the next developer or reader more context in the story we are telling?</p><p>One more code sample — references the objects above:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4cb0df0162c7ea98614524fadb1a5457/href">https://medium.com/media/4cb0df0162c7ea98614524fadb1a5457/href</a></iframe><p>How do the above statements read?</p><p>One asks clearly if the character is moving. We still don’t know if the character is walking or if the character is moving houses.</p><p>The other one, asks if my character moves? Its a way more ambiguous question.</p><h3>How do I improve my ability to tell a story?</h3><p>One important trait: <strong>caring</strong>.</p><p>You need to care about your code and you need to care about the audience who will read your code.</p><p>Three items for gaining experience:</p><ul><li>Reading</li><li>Writing</li><li>Reviewing/Refactoring</li></ul><p>Uncle Bob states the ratio of reading code to writing code is 10:1. Stephen King states that “the more you read, the less apt you are to make a fool of yourself with your pen or word processor.” When you read code, be critical. Notice the good and the bad. Notice your first reaction to what you are reading. Pay attention to the story you are building in your head as you read the code.</p><p>You can read code all day, every day. If you never start writing any and debating on the word choice, you won’t ever get experience actually writing code. It doesn’t matter where you start and it doesn’t need to be perfect the first time. Start with what you know. Kent Beck says, “Make it work; then make it right; then make it fast.” In that, focus on readability and the clarity of the story you are building.</p><p>Reviewing and Refactoring. You need to review your own code, you need to refactor your own code, and you need to have other people review and refactor your code. If you were writing a paper for a class or an article or a novel, someone would review it, or edit it. You may leave it for a while, for a month, for 3 months. The more time that passes, the less bias you will have when you reread it. It will seem like a new story, and you will have more experience coding.</p><h3>My Recommend Reading List</h3><h4>Programming</h4><ul><li><a href="https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882"><em>Clean Code</em> Robert C Martin (Uncle Bob)</a></li><li><a href="https://www.amazon.com/Design-Everyday-Things-Donald-Norman/dp/1452654123"><em>The Design of Everyday Things </em>Donald A Norman</a></li><li><a href="https://github.com/getify/You-Dont-Know-JS"><em>You Don’t Know JS</em> Kyle Simpson</a></li></ul><h4>Writing</h4><ul><li><a href="https://www.amazon.com/Writing-10th-Anniversary-Memoir-Craft/dp/1439156816/ref=tmm_pap_swatch_0?_encoding=UTF8&amp;qid=&amp;sr="><em>On Writing</em> Stephen King</a></li></ul><p>In high school, two more books for writing were recommended — I’m still trying to finish them.</p><ul><li><a href="https://www.amazon.com/Room-Ones-Own-Virginia-Woolf/dp/1614272778"><em>A Room of One’s Own</em> Virginia Woolf</a></li><li><a href="https://www.amazon.com/Portrait-Artist-Young-Thrift-Editions/dp/0486280500"><em>A Portrait of a Young Man as an Artist</em> James Joyce</a></li></ul><h3>References</h3><ul><li><em>Clean Code</em> Robert C Martin</li><li><em>On Writing</em> Stephen King</li><li><a href="https://frontendmasters.com/teachers/kyle-simpson/code-is-for-humans/"><em>Code is for Humans</em> Kyle Simpson</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54cf17a0d336" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/telling-a-story-with-your-code-54cf17a0d336">Telling a Story with Your Code</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One React Native Video Interface. 12 Platforms.]]></title>
            <link>https://medium.com/g2idev/one-react-native-video-interface-12-platforms-8af42931d294?source=rss----ac27bebdb838---4</link>
            <guid isPermaLink="false">https://medium.com/p/8af42931d294</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[g2i]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[you-tv]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Andrei Calazans]]></dc:creator>
            <pubDate>Thu, 04 Apr 2019 00:20:13 GMT</pubDate>
            <atom:updated>2019-04-04T11:03:57.344Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ToEhJ-LLLL011Pnn.jpg" /><figcaption>Taken from <a href="https://media.wochit.com/wp-content/uploads/0405-Covers.jpg">google</a> 0_0</figcaption></figure><p><em>Originally posted on </em><a href="https://www.youi.tv/react-native-video-interface-12-platforms/"><em>https://www.youi.tv/react-native-video-interface-12-platforms/</em></a></p><p>When You.i TV approached G2i to help build a streaming video app using their You.i Engine One SDK, I was a bit worried. One, we as a company had never built a streaming app before so I knew we’d run into unique challenges. Two, the list of target platforms was broad; handsets, tablets, and TV devices. Three, React Native was to be the main framework.</p><p>I have been part of several React Native projects targeting handsets and tablets, but I’ve never had to deal with TV-connected devices. This, along with the streaming aspect, caused a bit of concern.</p><p>What about the cross-platform video solution?</p><p>Based on my previous experience, I knew that in order for G2i to deliver a high-quality cross-platform video player in React Native, we would need to bridge a video component to its native counterpart on each platform we were targeting.</p><p>To target TV platforms, the following native video interfaces needed to be maintained:</p><ul><li><a href="https://developer.apple.com/documentation/avfoundation/avplayer">AVPlayer</a> for iOS and Apple TV, interface in Objective-C or Swift</li><li><a href="https://developer.android.com/guide/topics/media/exoplayer">ExoPlayer</a> for Android and Fire TV, interface in Java or Kotlin</li><li><a href="https://sdkdocs.roku.com/display/sdkdoc/Video">Roku Video Player</a>, interface in Brightscript and SceneGraph</li><li><a href="https://developer.samsung.com/tv/develop/api-references/samsung-product-api-references/avplay-api">AVPlay for Tizen</a>, interface in JavaScript</li></ul><p>I found an open sourced project called <a href="https://github.com/react-native-community/react-native-video">react-native-video</a> which is an attempt to bridge a video solution for React Native. It’s quite powerful but it doesn’t offer support for Roku and Tizen. It also wouldn’t help reduce the size of the effort needed to invest to get these apps out the door. React-native-video has over 10,000 lines of code and documentation across four languages (3.2k Java, 1.6k JS, 1.6k Obj-C, 1.1k C#, 1k documentation), as well as 482 opens issues, 621 closed.</p><p>It’s not easy bridging a video interface.</p><h3><strong>You.i Engine One SDK</strong></h3><p>At first, I thought You.i Engine One was just a rendering solution which allowed developers to reference After Affects drawings as components. I was not aware of the deeper features it possessed.</p><p>Besides helping me connect my components with elements created by designers, it also provides a set of tools to get the work done. One of these tools is a video interface in React Native. Turns out, rendering a video component to 12 different platforms wasn’t a cause for concern after all. All I have to do is write the following component in React Native.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2d15b699259a329c96990820f27e9aef/href">https://medium.com/media/2d15b699259a329c96990820f27e9aef/href</a></iframe><p>The above renders to:</p><ul><li>Roku</li><li>Fire TV</li><li>iOS &amp; tvOS</li><li>Android &amp; Android TV</li><li>PlayStation 4</li><li>Xbox One</li><li>Samsung Tizen</li><li>Desktop Platforms: Windows, MacOS, and Linux</li></ul><p>The video component is part of You.i Engine One, no bridge is necessary to access it.</p><p>I was amazed at how easy this was. Thanks to this component, we are able to focus on building the software. No time was wasted bridging and preparing underlying components for use.</p><h3><strong>Making use of the Video interface</strong></h3><p>Still not convinced? Here’s a complete example.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b52f2c2426f0c59c48a5f4233d2db848/href">https://medium.com/media/b52f2c2426f0c59c48a5f4233d2db848/href</a></iframe><p>By simply using the Video component, we have a video interface which renders to the screen as follow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iOfFKi9f6JWDio_I.gif" /><figcaption><em>Video playback on handset (landscape)</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GwV6wZakd-ESC7P7.gif" /><figcaption><em>Video playback on tablet</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*St1paS_LcjIrl-T6f8F5lA.gif" /><figcaption><em>Video playback on OSX</em></figcaption></figure><p><strong>Congratulations, you got 100+ hours of development work done in less than 30 minutes by using the video component provided by Engine One.</strong></p><p>The code displayed in the example above is available in this <a href="https://github.com/AndreiCalazans/YouiTestApp">repository</a>.</p><h3><strong>Our journey with You.i Engine One</strong></h3><p>You.i Engine One is an amazing product to work with. The product team at You.i TV is always available to help us out and give us the support we need. We are currently building an amazing application on behalf of the You.i TV team and we are eager to share our experiences once this app hits production. Feel free to read along <a href="https://blog.g2i.co/">G2i’s blog</a> to learn more about what we’re up to.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8af42931d294" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/one-react-native-video-interface-12-platforms-8af42931d294">One React Native Video Interface. 12 Platforms.</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Focus Management with React Native on TV Platforms]]></title>
            <link>https://medium.com/g2idev/focus-management-with-react-native-on-tv-platforms-6b432f5822a6?source=rss----ac27bebdb838---4</link>
            <guid isPermaLink="false">https://medium.com/p/6b432f5822a6</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Guillermo Velásquez]]></dc:creator>
            <pubDate>Fri, 08 Mar 2019 00:43:44 GMT</pubDate>
            <atom:updated>2019-03-08T00:43:44.416Z</atom:updated>
            <content:encoded><![CDATA[<p>Over the past couple of months, we’ve been building a React Native-based streaming video app for mobile, tablet, and TV devices using You.i TV’s cross-platform SDK, <a href="https://www.youi.tv/youi-engine/">You.i Engine One</a>. We’ve talked before about our experience <a href="https://www.youi.tv/taming-the-living-room-tv-with-react-native-on-you-i-engine-one/">working with You.i Engine One</a> as a whole but today we want to dig down deep and talk about a feature that we really enjoy: the FocusManager.</p><p>When developing applications for connected TV and Smart TV platforms, it’s important to remember that user input comes from a remote.</p><p>Shocking, right?</p><p>Now that I’ve stated the obvious, how do we, as developers, handle and give proper feedback to the user when they are interacting with said remote? Enter Focus Management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kd0G0_Z0nNPI3nYu.jpeg" /><figcaption><em>Photo by </em><a href="https://unsplash.com/photos/XXFw9FiPBec?utm_source=dropbox_paper&amp;utm_medium=referral"><em>rawpixel</em></a></figcaption></figure><p>Focus management is required to make TV navigation easy for users. Without it, there is no way to let the user know if a visual element — like selecting an image or button — requires any further action. So, to build an app for a TV platform, we need a way to handle and give feedback about the focus of UI elements within the app. That’s where You.i Engine One’s FocusManager comes in.</p><p><strong>Focus Management With You.i Engine One</strong></p><p>When we first started developing for TV using You.i Engine One and its React Native solution, we were emulating the TV UI on a macOS app. So, we started developing features and using our pointer to interact with the UI. It wasn’t until later, when tickets about focus management started to show up, that we started testing on Android TV and used the remote control.</p><p>Now what?</p><p><strong>You.i Engine One is built for TV</strong></p><p>When we started paying attention to focus management, we went to You.i TV’s <a href="https://developer.youi.tv/5.1Beta3/Content/FocusManagementTopics/H1WhatsFocusMngmnt.htm?Highlight=focus%20management">documentation</a>. That’s when it became clear that You.i Engine One was developed with TV in mind. We found a full explanation on why focus management is important.</p><p>Moreover, we could rely on the same techniques and APIs for any TV platform supported by You.i Engine One. By the time of writing this piece, tvOS, Android TV, Amazon Fire TV, Roku, PlayStation 4, and Xbox One are all included.</p><p><strong>How does it work?</strong></p><p>The fundamentals behind focus management are the same between platforms: simple navigation and highlighting the selected element. Differences arise when implementing how the focus behaves.</p><p>By default, FocusManager only needs FocusIn and FocusOut timelines to make something focusable. This is done when using You.i Engine One’s After Effects Compositions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/0*Vp48U7W975mvnsgU.gif" /></figure><p>After the timeline hooks up to an item, the engine will pick it up by default. Then you’ll be able to see it getting focused by using the remote control on your platform or emulator. In practice, all it will do is play a certain animation that gives the user feedback on what it is happening on the screen.</p><p>So you should always have FocusIn and FocusOut timelines for any Ref to get it focused. If there is no focus animation on them, the user will never know if the particular view is selected or not.</p><p><strong>Advanced Techniques with FocusManager</strong></p><p>In most cases, the default focus behavior is enough for apps built with You.i Engine One. If we need to tweak the default behavior, we can do so. There are two main ways we can interact with the focusability of elements:</p><p><strong>Hooking up onFocus and onBlur props to focusable elements</strong></p><p>Once we have made an element focusable, we can hook up to its focus and blur events. This is particularly helpful when we want to hook up extra logic on top of the animations to the UI elements. For example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2758741059933daa1168d2b081176720/href">https://medium.com/media/2758741059933daa1168d2b081176720/href</a></iframe><p><strong>Using the FocusManager module</strong></p><p>You.i Engine One exposes the FocusManager module which lets us override the default behavior.</p><p>The FocusManager module exposes the following API:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a04174fff7a534ac642732bec3833ad/href">https://medium.com/media/3a04174fff7a534ac642732bec3833ad/href</a></iframe><p>With the Focus Manager, we can do pretty cool stuff, like:</p><ol><li><strong>Autofocus:</strong> A great user experience eases navigation and guides the user. For example, when filling out a form in an app, the focus inputs should guide where we want the user to enter information. The same notion applies to TV platforms. When a user goes to a particular screen, we want to focus on the next immediate action:</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd01e8682ffb885b9c47749d397997b6/href">https://medium.com/media/dd01e8682ffb885b9c47749d397997b6/href</a></iframe><p><strong>2. Overriding focusable elements:</strong> The default focusability of elements in You.i Engine One is somewhat related to the position of elements on screen. Take a look at the following image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1M1an1Ct7WcT_ETa.png" /></figure><p><em>A linear list of elements, focusable all in line to the right.</em></p><p>The expected focusability of this list when pressing right on the controller would be: A, B, C and D. As we should expect. However, look at the next two images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/0*bwetNyiZPz2hHxo3.png" /></figure><p><em>The ideal focusability of elements.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/0*mcPujUo72ZiE-yQi.png" /></figure><p><em>Focus Manager assumes that C is the next element to A.</em></p><p>The image on the left shows how we want the focusability top work when pressing “right” on our remote. Yet, as the FocusManager maps elements upon their position, it assumes that the next element to A is C.</p><p>To override this behavior, we must use the setNextFocus method call like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6bd56c5b8c232f9dd394310dc62a08e4/href">https://medium.com/media/6bd56c5b8c232f9dd394310dc62a08e4/href</a></iframe><p><strong>3. Setting a “focus root”:</strong> If you want to “lock” on a certain view and its children while ignoring everything around it, you can set up a focus root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y8RV6omORXyatKRI.png" /></figure><p><em>Locking focus to a certain ViewRef as the “root”</em></p><p>In this example, we want to lock the focusability of elements to those inside the green rectangle. We might want to do that to restrict the user from being able to focus elements outside that green area. This is especially useful when triggering modals. To set up a focus root, we simply write some code similar to the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2978afe7f433e652a29f8963f240bf99/href">https://medium.com/media/2978afe7f433e652a29f8963f240bf99/href</a></iframe><p><strong>4. onFocus(or onBlur)InDescendants:</strong> This is particularly useful for lists of items when you want to apply the same onFocus or onBlur event to all elements of a list.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b662db366c6f56dbf318015122bc8d45/href">https://medium.com/media/b662db366c6f56dbf318015122bc8d45/href</a></iframe><p><strong>Bonus: There’s a Focus Debugger!</strong></p><p>Remember when I said You.i Engine One was built for TV? Well, it has a nifty debugger with all sorts of cool options. The one place I go to every time I’m developing a feature for a TV platform is the focus debugger.</p><p>It essentially lets you understand where the focus is at the current moment, which element is the focus root, and what are the next focusable items in each direction.</p><p>I can’t express how many times this tool saved me hours of poking around and console logging.</p><p><strong>Room for improvement</strong></p><p>Although the FocusManager is a great tool, it does have a few drawbacks, mainly that its API is imperative. It makes playing nicely with React Native components somewhat troublesome with having to store the ref internally and then imperatively setting focus.</p><p>Here’s hoping future versions of You.i Engine One might have the capabilities to have declarative props on Refs like:</p><ul><li>lockFocus for ViewRefs to automatically setFocusRoot on that ViewRef when mounted and…</li><li>focus for, similarly, telling the FocusManager to focus an element upon rendering it or updating it so we don’t have to store the ref and imperatively set the focus.</li></ul><p><strong>What About Vanilla React Native?</strong></p><p>At this point, you’re probably wondering why we didn’t just stick to vanilla React Native. After all, the official React Native documentation has an entry about <a href="https://facebook.github.io/react-native/docs/building-for-apple-tv">Building For TV Devices</a>. There is both support for Android TV and tvOS. It states that they’ve added support for React Native apps to “just work” when targeting TVs.</p><p>It’s fantastic news for development teams tasked with going cross-platform but at the time of writing this piece, there are some shortcomings.</p><p>TVs are not the main focus of React Native</p><p>From the beginning, the core platforms targeted by RN were mobile ones. It is understandable that, while RN apps could work on TVs, there is a lot of ground to cover, and it seems to not be actively on their pipeline.</p><p>In fact, there are some key issues worth noting are:</p><ul><li>Lack of Documentation: The material available for how to build an app for TVs using React Native is scarce. For instance, it barely references how to interact with UI elements. It mentions how touchable components and the TVEventHandler interface work for making items focusable and handling events. Yet, for someone who has never dealt with Focus Management, it is hard to get started. It is pretty much left to a long trial and error session.</li><li>Few Platforms: Official support on React Native only covers Android TV and tvOS. If we are targeting an application for several platforms (like Roku, Xbox, PlayStation, etc…), then the official support falls short.</li></ul><p>After working with You.i Engine One and having conversations with You.i TV’s React Native team, I know that they are working hard to improve their engine. So far, we at G2i have been pretty impressed with what we are able to achieve with it. As with any tool that is pushing the edge of what it is possible, they are making sure that those little issues get covered along the road.</p><p>If you’d like to read more about what we’re up to over at G2i, <a href="https://blog.g2i.co/">visit our blog</a>.</p><p><em>Originally published at </em><a href="https://www.youi.tv/focus-management-react-native-tv"><em>www.youi.tv</em></a><em> on March 6, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b432f5822a6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/focus-management-with-react-native-on-tv-platforms-6b432f5822a6">Focus Management with React Native on TV Platforms</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[react navigation 3.2: new back behaviors for tab navigators]]></title>
            <link>https://medium.com/g2idev/react-navigation-3-2-new-back-behaviors-for-tab-navigators-57479772178d?source=rss----ac27bebdb838---4</link>
            <guid isPermaLink="false">https://medium.com/p/57479772178d</guid>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Seb @ ThisWeekInReact.com]]></dc:creator>
            <pubDate>Wed, 27 Feb 2019 06:14:20 GMT</pubDate>
            <atom:updated>2019-02-28T16:32:06.316Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://twitter.com/sebastienlorber"><strong>Sébastien Lorber</strong></a> is a React Native developer, member of the react navigation team. He’s pleased to announce his latest contribution: Instagram-like history-based back behavior for all tab navigators.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2BPUapLLOPOytee4GlW7NA.png" /></figure><p>Before react navigation 3.2, the only back behaviors available for a tab navigator were:</p><ul><li><strong>none</strong>: the back action does not affect the tabs at all</li><li><strong>initialRoute</strong>: the back action resets to the config’s initial route</li></ul><p>For a long time, it has been requested to add more back behaviors to tab navigators (<a href="https://github.com/react-navigation/react-navigation/issues/678">link1</a> <a href="https://github.com/react-navigation/react-navigation/issues/1545">link2</a> <a href="https://react-navigation.canny.io/feature-requests/p/implement-additional-backbehavior-options-for-tabrouter">link3</a> <a href="https://github.com/react-navigation/react-navigation/pull/889">link4</a> <a href="https://github.com/react-navigation/react-navigation/issues/2515">link5</a>). An official <a href="https://github.com/react-navigation/rfcs/blob/master/text/0008-back-behaviour-for-tabs.md">RFC</a> was made to design the feature.</p><p>In case you missed it, two new back behaviors were implemented on this <a href="https://github.com/react-navigation/react-navigation-core/pull/31">PR</a> and released on react navigation 3.2: <strong>order</strong> and <strong>history</strong>. They mostly make sense for tab navigators, but you are free to use them on any navigator that uses a SwitchRouter: switch navigator, tab navigator…</p><h3>order</h3><p>This new back behavior will simply navigate to the previous tab in the config order. When on 4th screen, back actions will lead to 3rd screen, 2nd screen, 1st screen, and then exit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*eR05H7zK_MdwO_phGv8mcQ.gif" /></figure><h3>history</h3><p>This new back behavior will navigate to the previously displayed tab in the navigation history. This is the navigation pattern used on Instagram app.</p><p>Tab deduplication will happen when a tab is visited more than once. In the example below with 4 tabs, it is guaranteed to exit the tab navigator within 4 back actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*ZzHyXgysNIElk5L9X2KrqQ.gif" /></figure><h3>Try it out</h3><p>The examples above are published on <a href="https://exp.host/@slorber/react-navigation-core-demo">Expo</a> and runnable from the <a href="https://github.com/react-navigation/react-navigation-core">react-navigation-core</a> repo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*buFq8MbvN_30Y1FUgiNDlw.png" /></figure><p>Thanks to <a href="https://medium.com/u/d5a707474bd2">Brent</a>, <a href="https://medium.com/u/f34d331b9b55">Eric</a> and <a href="https://medium.com/u/166675f65aaf">Satyajit</a> for their help.</p><p>Interested to learn more about react navigation, react native, Expo or Typescript? Follow our guest blogger Sébastien Lorber on <a href="https://github.com/slorber"><strong>Github</strong></a> and <a href="https://twitter.com/sebastienlorber"><strong>Twitter</strong></a>.</p><p>Thanks to <a href="https://www.g2i.co/"><strong>G2i</strong></a> for publishing this post. <a href="https://www.g2i.co/"><strong>G2i</strong></a> is a hiring platform run by engineers that matches clients with pre-vetted React, React Native, GraphQL, and native iOS/Android focused engineers you can trust.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57479772178d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/g2idev/react-navigation-3-2-new-back-behaviors-for-tab-navigators-57479772178d">react navigation 3.2: new back behaviors for tab navigators</a> was originally published in <a href="https://medium.com/g2idev">g2i_co</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>