<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Manuel Zambrano on Medium]]></title>
        <description><![CDATA[Stories by Manuel Zambrano on Medium]]></description>
        <link>https://medium.com/@manuelm3z?source=rss-5abdce3bc7cc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*5qyhnpOkwVIUxlbM.jpg</url>
            <title>Stories by Manuel Zambrano on Medium</title>
            <link>https://medium.com/@manuelm3z?source=rss-5abdce3bc7cc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 08:32:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@manuelm3z/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introduction to React Native Animations]]></title>
            <link>https://medium.com/@manuelm3z/introduction-to-react-native-animations-aeeb86fc3fb6?source=rss-5abdce3bc7cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/aeeb86fc3fb6</guid>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Manuel Zambrano]]></dc:creator>
            <pubDate>Tue, 26 Nov 2019 18:56:20 GMT</pubDate>
            <atom:updated>2019-11-26T18:56:20.028Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gj_mxMOlCQ3vgIjnDKeY-Q.jpeg" /></figure><p>Animations can give to our apps a sense of smoothness and make them look fluid, of course if we don’t abuse their use. We can use it to give feedback to our users with big animations or small things like the so called micro-interactions, in this post I only want to talk about how we can start doing it in React-Native.</p><p>If you come from the web you maybe are used to use CSS or some JS library in RN you can use a third party library as well but in this case I want to focus on the API provided by RN.</p><p>There’s two ways to make animations. You can use <em>LayoutAnimation API</em> or <em>Animated API,</em> the first one allow you to make simple animations that affects properties like opacity and transform using functions such as spring, linear and easeInEaseOut, in fact LayoutAnimation provides preset animations using these; the second one allow you to build more elaborate animations using the different configurations.</p><h3><strong>LayoutAnimation</strong></h3><p>I like to compare LayoutAnimation with <em>transition</em> property from CSS as a way to understand it, you only have to take care about what you want to change in your component and let that the presets functions do their magic.</p><p>These animations are really easy to implement, you just have to import it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gZzHVS6i0VEqQ0zXvg7PNg.png" /></figure><p>And use it at the moment you change the state</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-O2gE5vUGNurMFImyXKtsA.png" /></figure><p>As a result this show and hide the text, changing the opacity. It’s the same implementation for linear and easeInEaseOut.</p><p>If you want to modify these preset animations you can use the method <em>configureNext</em> which receive the config object, this config object can be formed using the method <em>create</em> which receive the constants provided by LayoutAnimation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*jk4HA9zRtyMyQuqnv_vnPA.png" /><figcaption>This create an animation with 500ms duration, the type spring and affects the X and Y in whatever element changes its state.</figcaption></figure><p>Something to noted here is that LayoutAnimation it’s always used when you dispatch any change in the state.</p><h3><strong>Animated</strong></h3><p>This API provides options to create a more complex animation. Includes components such as <em>View</em>, <em>Text</em>; composable functions as <em>sequence </em>or<em> parallel, </em>configurable functions as <em>timing </em>and a class <em>Value </em><strong><em>-</em>there’s more functions and classes but the scope of this post will cover only the mention above-</strong> how can we use it?</p><p>The first thing that we need to know it’s that the class Value it’s the protagonist so everything will be around it, we can instantiate this class in a const but the examples in the react web use a state so let’s do it that way, could be the state in a component class based or a hook useState.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xxF8LmsM4aaYsRftDzurmw.png" /><figcaption>We’re using only the current value var, the setValue es done it by Animated</figcaption></figure><p>The value -<em>in this case opacity</em>- would be use in a style for a component, don’t forget that the component should be a <strong><em>Component</em></strong> offered by Animated, this doesn’t mean that we can’t build our owns components, but I rather write about it in another post<strong><em>.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_RgjfM1vtyCVs5srXAptjg.png" /></figure><p>Now we need run the animation, in this case I will use <em>timing</em> function to do so.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*LOM_4_ILwmQOWBzJ7PJS_A.png" /><figcaption>We’re saying here, turn into value 1 in 1 seg</figcaption></figure><p>The timing function would change the value of any instance of the class Animated.Value, the code above could be inside a function and be called every time that the user press a button or just be executed at the beginning with a hook.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*JdKovpHqaVCp2HkKvMn0hQ.png" /></figure><p>Create animations aren’t the hardest part of build apps in RN, we only have to start playing with the API, change the styles and see the results so go ahead!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aeeb86fc3fb6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>