<?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[Committer Engineering - Medium]]></title>
        <description><![CDATA[Advocating Commitocracy. - Medium]]></description>
        <link>https://medium.com/committer-engineering?source=rss----9b0c45233d87---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Committer Engineering - Medium</title>
            <link>https://medium.com/committer-engineering?source=rss----9b0c45233d87---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 23:48:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/committer-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Implementing FoldView in React Native]]></title>
            <link>https://medium.com/committer-engineering/implementing-foldview-in-react-native-e970011f98b8?source=rss----9b0c45233d87---4</link>
            <guid isPermaLink="false">https://medium.com/p/e970011f98b8</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jake Murzy]]></dc:creator>
            <pubDate>Fri, 11 Nov 2016 20:13:49 GMT</pubDate>
            <atom:updated>2026-10-22T14:15:41.907Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><a href="https://jakemurzy.com/blog/implementing-foldview-in-react-native">This article is cross-posted on my personal blog.</a></blockquote><p>What’s most amazing to me about React Native is how quickly one can go from idea to product. Applying the state-of-the-art in Web to native app development is a game changer.</p><p>To developers coming from Obj-C, Swift and Java, the idea of having JavaScriptCore to batch process UI updates to native views may seem counter-intuitive from a performance perspective. For most UI tasks though, this approach has proven to work surprisingly well and is painstakingly tuned for near-zero performance loss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*ZSTsRfLAuIheK4ht8SSbIQ.png" /></figure><p>This allows you to embrace the component mentality and create small, composable components to build complex native UIs. And, in those rare occasions, when React Native’s capabilities fall short, it also provides you with an escape hatch that can be used to make platform-specific performance tweaks in native code.</p><h4>Animations in React Native</h4><p>A common question people ask is whether you can use only JavaScript to create animation-heavy UIs without having the need to write native code. Despite its potential pitfalls, the prescribed way of doing animations in React Native has been and still is the <a href="https://facebook.github.io/react-native/docs/animated.html">Animated</a> module. Animated uses data binding internally to directly mutate properties of the underlying native views. This avoids <em>render</em> thrashing, and ultimately, gives us <em>O(1)</em> update performance — which is very crucial to smooth, 60<em>fps</em>, animations in React Native.</p><p>Animated is declarative, and with the recent contributions made by the community, it has partial support for offloading animations from the JavaScript thread via a native module. This makes most bridge-related performance issues irrelevant.</p><p>Although Native Animated is still a work-in-progress, it’s obvious that the native driver as well as <a href="http://isfiberreadyyet.com/">React Fiber</a>’s incremental rendering capabilities will both play a key role in building performant applications in React Native in the future. Until then, though, we are still left to deal with the drawbacks associated with building such animations into user experiences.</p><h3>Implementing FoldView in JavaScript</h3><p>Recently, a member of the React Native Facebook community <a href="https://www.facebook.com/groups/react.native.community/permalink/848163168652596/">posted a GIF</a> of a folding view animation calling for help from Obj-C and Java developers to implement it in React Native. The post quickly attracted a lot of attention and highlighted the common interest in building interactive experiences in React Native.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*-ZKoNlYFNCZvQIjcpEztxQ.gif" /><figcaption>Source: <a href="https://dribbble.com/shots/2121350-Delivery-Card">Dribbble</a></figcaption></figure><p>One of the things I love most about UI challenges, is that it gives me an excuse to try things I’ve been wanting to try for a long time. So I took this challenge upon myself to contribute a JavaScript-only implementation of the FoldView to the React Native community.</p><h4>No Transform Origin Support</h4><p>The first challenge in implementing the FoldView was to figure out how to rotate the element around its x<em>-axis</em> counterclockwise and apply <em>perspective </em>distortions to activate 3D space.</p><p>Both the<em> rotateX and perspective </em>transforms are members of the React Native subset of the available CSS styles. But we will also need to ensure the element’s transform origin occurs at the bottom of our view. And unfortunately for us, <em>transform-origin</em> is not a supported property in React Native. So if we were to use the built-in <em>rotateX</em> transformation by itself, the pivot point for the rotation would occur at the center of the element which is the default behavior and that’s not what we want.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fjmurzy%2Fk8vbb4pz%2Fembedded%2Fresult%2F&amp;display_name=jsFiddle&amp;url=https%3A%2F%2Fjsfiddle.net%2Fjmurzy%2Fk8vbb4pz%2Fembedded%2Fresult%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/8298615b82afa4215fe4b43f2132bc79/href">https://medium.com/media/8298615b82afa4215fe4b43f2132bc79/href</a></iframe><p>In a perfect world, React Native would support <em>transform-origin </em>out of the box. But the current implementation of the layout system doesn’t easily allow for this. React Fiber will possibly fix many of these layout issues via its <a href="https://www.youtube.com/watch?v=aV1271hd9ew#t=28m51s">Integrated Layout</a> feature. In the meantime, we’ll have to hack our way through to achieve the desired result.</p><h3>Affine Transformations</h3><p>The <em>matrix </em>property<em> </em>has to be one of the least used in CSS. <a href="https://www.w3.org/TR/SVG/coords.html#TransformMatrixDefined">Matrix transformations</a> allow for repositioning, scaling, skewing and rotation giving you complete control over how an element is displayed in its coordinate space. Transformations such as <em>translate</em>, <em>scale</em>, <em>skew </em>and<em> rotate</em> are simply abstractions to matrices and matrix operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*KPWvJCNVk2Q_MSKzan2V7w.png" /><figcaption>Source: <a href="http://xkcd.com/184/">http://xkcd.com/184/</a></figcaption></figure><p>Although <em>Animated</em> does not have support for the <em>matrix </em>property, it’s a valid React Native style property that can be used to define mathematical matrix transformations on your views.</p><p>No Animated support also means we won’t be able to offload the matrix operations via the native driver. Instead, on each frame, we will use matrix algebra to manipulate the individual elements of our matrix and use <a href="http://facebook.github.io/react-native/releases/0.35/docs/direct-manipulation.html#direct-manipulation"><em>setNativeProps</em></a> to set a new value directly on the DOM node, and flush it over the bridge. The matrix operations will still be driven by the JavaScript thread and they will be bridge-bound, but relatively speaking, this allows for much greater performance over triggering a re-render and is also what is used by Animated in its underlying implementation.</p><h3>Taking the Red Pill</h3><p>In this demo, we will be dealing with 4x4 matrices for the 2D transforms we want to compute.</p><p>Let’s finally write some code.</p><h4>rotateX</h4><p>To rotate an object by d<em>x</em> degrees about the x-axis, we would have to apply the following transformation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*ETMmlHzGfIC4Djma2OBe6A@2x.png" /><figcaption>x-rotation in 3D</figcaption></figure><p>And the gist below shows what it would look like in JavaScript.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d79ab81eabecce22a2cd101590800d7a/href">https://medium.com/media/d79ab81eabecce22a2cd101590800d7a/href</a></iframe><p>This will spin an object around its horizontal axis and is essentially what the built-in <em>rotateX</em> does for you less the origin transformation step we will do next to achieve the “flip fold” effect.</p><p>Note that since Math.<em>cos</em> and Math.<em>sin</em> take angles in radians, we also had to convert degrees to radians in our rotateX function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*tgd2S85b5H4dvKB9MdXeNg@2x.png" /><figcaption>Degrees to Radians</figcaption></figure><h4>transform-origin</h4><p>Rotations are based from the origin. So applying rotation to an element that is centered at the origin will give a different result than an element that has been translated away from the origin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*_Aq_OCm71nDFtpTDAopcrQ@2x.png" /><figcaption>Transform origin of a view is at its horizontal and vertical center by default</figcaption></figure><p>Since the transform origin of a view is at its horizontal and vertical center by default, to rotate it in x<em>-space along the bottom</em>, we need to first shift our view’s origin on the y-axis by 50% of the view’s height, then apply rotation, then shift it back to the original center.</p><p>To do that, we will multiply our matrix by an <a href="https://en.wikipedia.org/wiki/Identity_matrix">identity matrix</a> of which the y-component is equal to 50% of the height of our object, and then multiply the resulting matrix once more, where y = -(h/2) to restore origin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*vDRCtX2laroNS5JaghP2nA@2x.png" /><figcaption>Shifting origin on the y-axis by h/2</figcaption></figure><p>Luckily, React Native has a private module named <em>MatrixMath</em> that we can use to avoid doing dot multiplication by hand. So here’s the transform-origin helper function that we will use in composing the result of our final transform.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/251c36d437a59719450f40c4110f30c0/href">https://medium.com/media/251c36d437a59719450f40c4110f30c0/href</a></iframe><h4>perspective</h4><p>Finally, to create perception of depth, we need to set the <em>perspective</em> property so that points in z-space are not flattened onto the same 2D plane when the transformation is applied. As I mentioned earlier, React Native has built-in support for <em>perspective</em>. So we’ll simply set it to produce an illusion of depth in the resulting transform.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fjmurzy%2F7k1rc47h%2Fembedded%2Fresult%2F&amp;display_name=jsFiddle&amp;url=https%3A%2F%2Fjsfiddle.net%2Fjmurzy%2F7k1rc47h%2Fembedded%2Fresult%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b6a1632a84ffd0e6eecaa1d63098408/href">https://medium.com/media/2b6a1632a84ffd0e6eecaa1d63098408/href</a></iframe><h3>And, voilà!</h3><p>Add all these these together and just like that you should have a beautiful flip animation.</p><p>There are a lot of other details that I did not cover in this post. I strongly urge you to read the <a href="https://github.com/jmurzy/react-native-foldview">FoldView source code</a> on Github. The code is pretty short and easy to grasp.</p><h3>Jake Murzy on Twitter: &quot;Woot woot. I just open-sourced react-native-foldview. 🎉🤖 #reactnative #reactjs https://t.co/l5ECE6ib6z pic.twitter.com/2x1lrrCzCg / Twitter&quot;</h3><p>Woot woot. I just open-sourced react-native-foldview. 🎉🤖 #reactnative #reactjs https://t.co/l5ECE6ib6z pic.twitter.com/2x1lrrCzCg</p><h3>Wrapping Up</h3><p>I might be repeating myself, but React Native is awesome. As with many other things, there are times and places where maxims and rules may need to be altered to best answer a question. Although, React Native abstracts away a great deal of the complexity for you, you should not be afraid to actually look under the hood and may need to tweak a thing or two to make it work for you.</p><p>As always, if you have any questions, feel free to get in touch on Twitter, <a href="http://twitter.com/jmurzy">@jmurzy</a>, or on <a href="https://github.com/jmurzy">Github</a>.</p><p>🍺</p><p>— Jake</p><p><em>Thanks to </em><a href="https://medium.com/u/b0affb225289"><em>Mateusz Zatorski</em></a><em> and </em><a href="https://medium.com/u/166675f65aaf"><em>Satyajit Sahoo</em></a><em> for reading drafts of this post.</em></p><p><strong><em>Did you enjoy the article? Please don’t forget to click the ❤ to recommend it to others and share.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e970011f98b8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/committer-engineering/implementing-foldview-in-react-native-e970011f98b8">Implementing FoldView in React Native</a> was originally published in <a href="https://medium.com/committer-engineering">Committer Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing React Router Native]]></title>
            <link>https://medium.com/committer-engineering/introducing-react-router-native-b02e76b8ca5d?source=rss----9b0c45233d87---4</link>
            <guid isPermaLink="false">https://medium.com/p/b02e76b8ca5d</guid>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Jake Murzy]]></dc:creator>
            <pubDate>Wed, 14 Sep 2016 23:54:27 GMT</pubDate>
            <atom:updated>2026-10-22T14:14:40.637Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn Once, Write Anywhere</h4><blockquote><a href="https://jakemurzy.com/blog/introducing-react-router-native">This article is cross-posted on my personal blog.</a></blockquote><p>I’m very excited to announce a project that has been a few months in the making, <a href="https://github.com/jmurzy/react-router-native">react-router-native</a>, a routing library for <em>React Native</em> that strives for sensible API parity with <a href="https://github.com/reactjs/react-router/">react-router</a>.</p><p>This project was born out of my frustration while searching for a router to use with <em>React Native</em>. Unfortunately, <em>React Router</em> itself <a href="https://github.com/reactjs/react-router/issues/743">doesn’t have support</a> for <em>React Native</em>, and the <em>NavigationExperimental</em> team has <a href="https://github.com/ericvicenti/navigation-rfc/issues/64#issuecomment-209001717">no intention to support</a> a <em>React Router</em>-like interface. This leaves the navigation state up to the developer to maintain. As awesome as <em>NavigationExperimental</em> is, it is a bit too low level for people that want to focus on the real challenges of their apps and not the insignificant details of navigation state management. The low level nature of <em>NavigationExperimental</em> is only by design to allow greater abstractions to be built up in higher layers.</p><h3>Goals</h3><p>Primary goals of <em>React Router Native</em> are:</p><ul><li>URL Driven Development</li><li><strong>Learn once, write anywhere</strong>: knowledge and proven idioms from <em>React Router</em> can be reused while extending them as necessary to allow navigation semantics unique to native platforms</li><li>First class deep linking support</li><li>Cross-platform</li></ul><p>A declarative API removes the need to write boilerplate code and greatly speeds up native app development. <em>React Router</em> has done a pretty good job of this on the web. Following <em>React</em>’s “learn once, write anywhere” principle, I thought the best approach to creating a similar abstraction would be through marrying <em>React Router</em> concepts, or rather <em>React Router</em> itself, to those of <em>NavigationExperimental</em>.</p><p><em>React Router Native</em> is the product of this marriage. It provides a superset of <em>React Router</em>’s API, uses <em>React Router</em> to render navigational components and delegates rendering of user components to <em>NavigationExperimental</em>, all without taking away control—so you still have access to <em>NavigationExperimental features </em>to do all kinds of fancy transition animations if that’s what you need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*jUaWL3lyqocJNrCkEoE1Tg.gif" /><figcaption><em>React Router Native</em> example with <strong>address bar</strong></figcaption></figure><h3>Framework agnostic</h3><p>Since <em>React Router Native</em> manages navigation state for you, you don’t have to write reducers for each and every scene you want to render. In fact, <a href="https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367">if you are not a Redux-person</a>, you don’t even need to know what a <em>reducer</em> is to start using <em>React Router Native</em>.</p><p>This is especially useful when you are just getting started and all you need is to be able to click a button and have it transition to a different scene. The following code example does that and much, much more under 75 lines of code. I highly encourage you to compare the brevity of this example to whatever you may be using today.</p><p>When you are ready to explore further, there is a more complex <a href="https://github.com/jmurzy/react-router-native/tree/master/examples">example</a> in the repo that demonstrates various common patterns found in modern mobile applications.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/974dea5541558b28fe93cf576a351f61/href">https://medium.com/media/974dea5541558b28fe93cf576a351f61/href</a></iframe><h3>The Address Bar</h3><p>I admit the native app ecosystem is not web-like, and you can argue that URLs aren’t necessary. But I think, most people take URLs for granted and their advantages are not so pronounced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Z25DF6yisg6CFcxPTarnsw.png" /><figcaption><strong>Development mode</strong> in React Router Native</figcaption></figure><p><em>React Router Native</em> encourages URL driven development. A not so surprising perk of this is first-class deep-linking support. In <em>React Router Native</em>, you can toggle a prop on your <em>Router</em> to go into development mode. This places an address bar above your app and creates a browser-like environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*njI-DyMXvv61Ne1S6ZZCaw.gif" /></figure><p>I cannot stress enough how awesome it is being able to navigate your app via the address bar when developing native apps. You just have to <a href="https://github.com/jmurzy/react-router-native/blob/master/docs/Examples.md">hop on inside</a> and see it for yourself.</p><h3>Hardware Back Button</h3><p><em>React Router Native</em> provides sensible defaults to handle the user pressing the hardware back button on an Android device. This works “magically” without manual labor on your end. When the default behavior doesn’t work for you, it also provides you with the necessary hooks to <a href="https://github.com/jmurzy/react-router-native/tree/master/docs#hardware-back-button">customize the hardware back button behavior</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*n82D9yM215ZFbWSK1EbSqw.png" /></figure><h3>Closing Notes</h3><p>We’re still in the early days of <em>React Native</em> and <em>NavigationExperimental</em> figuring out the right abstractions. Navigation on mobile is a challenging task, and having different flavors is, in my opinion, only healthier as the community weighs the pros and cons of each approach rather than second guessing best-practices.</p><p>As for <em>React Router Native</em>, it is also at a very early stage and it’s intentional. I’m hoping to get the community involved to shape the direction of the project. A number of community members have already jumped in to help, and you should too.</p><p>Finally, <em>React Router Native</em> may or may not be the right venue for you. But if you use it and find it works for you, please take a moment to send a thank you note to the following members of the awesome React community who made all this possible:</p><p><strong>Ryan Florence</strong> <a href="http://twitter.com/ryanflorence">@ryanflorence</a>, <strong>Michael Jackson</strong> <a href="http://twitter.com/mjackson">@mjackson</a>, <strong>Eric Vicenti</strong> @ericvicenti and <strong>Hedger Wang</strong> <a href="http://twitter.com/hedgerwang">@hedgerwang</a></p><p>If you have any questions, feel free to get in touch on Twitter, <a href="http://twitter.com/jmurzy">@jmurzy</a>.</p><p>You can also jump in <a href="https://github.com/jmurzy/react-router-native/issues">Github issues</a> and start a conversation.</p><p>🍺</p><p>—Jake</p><p><strong><em>Did you enjoy the article? Please don’t forget to click the ❤ to recommend it to others and share.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b02e76b8ca5d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/committer-engineering/introducing-react-router-native-b02e76b8ca5d">Introducing React Router Native</a> was originally published in <a href="https://medium.com/committer-engineering">Committer Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>