<?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 Vyga Development on Medium]]></title>
        <description><![CDATA[Stories by Vyga Development on Medium]]></description>
        <link>https://medium.com/@vygaio?source=rss-2adc409f43b5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*BMMhtXWaHMsqYywo.jpg</url>
            <title>Stories by Vyga Development on Medium</title>
            <link>https://medium.com/@vygaio?source=rss-2adc409f43b5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 13:16:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vygaio/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[React Native — How to add Swift to your React Native Project in under 3 minutes]]></title>
            <link>https://medium.com/@vygaio/react-native-how-to-add-swift-to-your-react-native-project-in-under-3-minutes-e54483ba0ae9?source=rss-2adc409f43b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e54483ba0ae9</guid>
            <dc:creator><![CDATA[Vyga Development]]></dc:creator>
            <pubDate>Mon, 07 Aug 2017 00:23:16 GMT</pubDate>
            <atom:updated>2017-08-07T00:23:16.294Z</atom:updated>
            <content:encoded><![CDATA[<p>This is what you need.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4a64aedd43180832e6817e6be97b6f8e/href">https://medium.com/media/4a64aedd43180832e6817e6be97b6f8e/href</a></iframe><p>Done.</p><p>Now Try it out.</p><p><a href="https://gist.github.com/garrettmac/89e6dcb25784eea898a6cacbbe3748d2#file-index-ios-js">https://gist.github.com/garrettmac/89e6dcb25784eea898a6cacbbe3748d2#file-index-ios-js</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e54483ba0ae9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native — How to center Text and auto adjust font size inside a View Component]]></title>
            <link>https://medium.com/@vygaio/how-to-auto-adjust-text-font-size-to-fit-into-a-nodes-width-in-react-native-9f7d1d68305b?source=rss-2adc409f43b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f7d1d68305b</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react-native-component]]></category>
            <category><![CDATA[react-native-text]]></category>
            <category><![CDATA[center-text]]></category>
            <category><![CDATA[formatting]]></category>
            <dc:creator><![CDATA[Vyga Development]]></dc:creator>
            <pubDate>Wed, 19 Jul 2017 16:53:49 GMT</pubDate>
            <atom:updated>2017-10-13T22:05:11.492Z</atom:updated>
            <content:encoded><![CDATA[<p>SEE UPDATE AT BOTTOM.</p><p>So you’re having a hard time fitting your text in a node properly?</p><p>Well React Native has some undocumented properties you can add to to the &lt;Text&gt; Component (that currently not available on their <a href="https://facebook.github.io/react-native/docs/text.html">Text Components Docs Page</a>) but let’s start with the problem.</p><p>You have Text that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*g8dSQuFwFwYtOVSsccx4xg.png" /><figcaption>React Native List of Text Components (before fitted)</figcaption></figure><p>Your code prolly looks something like this:</p><pre>let array=[{&quot;subreddit_name_prefixed&quot;:&quot;r/worldnews&quot;,color:&quot;#FFBC42&quot;},{&quot;subreddit_name_prefixed&quot;:&quot;r/politics&quot;,color:&quot;#80CED7&quot;},{&quot;subreddit_name_prefixed&quot;:&quot;r/PublicBelief&quot;,color:&quot;#ABC4AB&quot;},{&quot;subreddit_name_prefixed&quot;:&quot;r/inthenews&quot;,color:&quot;#E26D5A&quot;}]</pre><pre>.......</pre><pre>&lt;View style={{flex: 1,height,width,justifyContent: &quot;center&quot;,flexDirection:&quot;row&quot;,alignItems: &quot;center&quot;,backgroundColor: &quot;#F5FCFF&quot;,}}&gt;<br>        {array.map((item,i) =&gt; {<br>            return (&lt;TouchableOpacity key={i}<br>              style={[{<br>                flex:1,<br>                backgroundColor:&#39;rgba(0,0,0,0)&#39;,<br>                  justifyContent:&quot;center&quot;,<br>                  alignItems:&#39;center&#39;,<br>                  borderRadius:10,<br>                  borderWidth:1,<br>                  borderWidth:2,<br>                  borderColor:&#39;rgba(0,0,0,.3)&#39;,<br>                  height:40,<br>                  margin:3,<br>                  backgroundColor:item.color,<br>              }]}&gt;<br>              &lt;Text<br>              //adjustsFontSizeToFit={true}<br>              //numberOfLines={1}<br>              style={{<br>                textAlignVertical: &quot;center&quot;,<br>                textAlign: &quot;center&quot;,<br>                backgroundColor:&#39;rgba(0,0,0,0)&#39;,<br>                color:&#39;rgba(0,0,0,.3)&#39;,<br>              }}&gt;{item.subreddit_name_prefixed}&lt;/Text&gt;<br>            &lt;/TouchableOpacity&gt;)<br>          })<br>        }<br>      &lt;/View&gt;</pre><p>So you looked around and saw this</p><p>this <a href="https://github.com/facebook/react-native/issues/728">https://github.com/facebook/react-native/issues/728</a></p><p>and this <a href="https://github.com/facebook/react-native/pull/4026">https://github.com/facebook/react-native/pull/4026</a></p><p>and this <a href="https://stackoverflow.com/questions/37571418/reactnative-how-to-center-text">https://stackoverflow.com/questions/37571418/reactnative-how-to-center-text</a></p><p>Nothing really solved this issue so you use this: <a href="https://github.com/ReactNativeBox/react-native-textfit">https://github.com/ReactNativeBox/react-native-textfit</a></p><p>BUT WAIT, don’t do it sicko, because you prolly never checked out the React Native Text Library itself before you did did you? Shame on you. You can do this by running the following from your Projects Root Directory.</p><pre>open node_modules/react-native/Libraries/Text</pre><p>What I found/ what you’re looking for is <a href="https://github.com/facebook/react-native/blob/master/Libraries/Text/RCTShadowText.h">https://github.com/facebook/react-native/blob/master/Libraries/Text/RCTShadowText.h</a></p><p>These are some (or all? — I haven’t looked through all the Text Folders Files) of the available Text Component’s parameters you can use. Where it would look like the following in yourrender() function:</p><pre>&lt;Text<br>        color={Color}<br>        fontFamily={String}<br>        fontSize={Float}<br>        fontWeight={String}<br>        fontStyle={String}<br>        fontVariant={NSArray}<br>        isHighlighted={Boolean}<br>        letterSpacing={Float}<br>        lineHeight={Float}<br>        numberOfLines={Integer}<br>        ellipsizeMode={NSLineBreakMode}<br>        shadowOffset={CGSize}<br>        textAlign={NSTextAlignment}<br>        writingDirection={NSWritingDirection}<br>        textDecorationColor={Color}<br>        textDecorationStyle={UnderlineStyle}<br>        textDecorationLine={TextDecorationLineType}<br>        fontSizeMultiplier={Float}<br>        allowFontScaling={Boolean}<br>        opacity={Float}<br>        textShadowOffset={CGSize}<br>        textShadowRadius={Float}<br>        textShadowColor={Color}<br>        adjustsFontSizeToFit={Boolean}<br>        minimumFontScale={Float}<br>        selectable={Boolean}&gt;<br>        Hiiiizz<br>      &lt;/Text&gt;</pre><p>After discovering this I found two that caught my eye adjustsFontSizeToFit and allowFontScaling and ended up just using adjustsFontSizeToFit .</p><p>My Final Code:</p><pre>&lt;View style={{flex: 1,height,width,justifyContent: &quot;center&quot;,flexDirection:&quot;row&quot;,alignItems: &quot;center&quot;,backgroundColor: &quot;#F5FCFF&quot;,}}&gt;<br>        {array.map((item,i) =&gt; {<br>            return (&lt;TouchableOpacity key={i}<br>              style={[{<br>                flex:1,<br>                backgroundColor:&#39;rgba(0,0,0,0)&#39;,<br>                  justifyContent:&quot;center&quot;,<br>                  alignItems:&#39;center&#39;,<br>                  borderRadius:10,<br>                  borderWidth:1,<br>                  borderWidth:2,<br>                  borderColor:&#39;rgba(0,0,0,.3)&#39;,<br>                  height:40,<br>                  margin:3,<br>                  backgroundColor:item.color,<br>              }]}&gt;<br>              &lt;Text<br>              adjustsFontSizeToFit<br>              numberOfLines={1}<br>              // allowFontScaling<br>              style={{<br>                /*<br>                 *   The following styles may cause conflict if used<br>                 *   in conjecture with &#39;numberOfLines&#39;<br>                 *   or &#39;adjustsFontSizeToFit&#39;: <br>                     =&gt;  fontSize, height, width, flex, margin<br>                */<br>                textAlignVertical: &quot;center&quot;,<br>                textAlign: &quot;center&quot;,<br>                backgroundColor:&#39;rgba(0,0,0,0)&#39;,<br>                color:&#39;rgba(0,0,0,.3)&#39;,<br>              }}&gt;{item.subreddit_name_prefixed}&lt;/Text&gt;<br>            &lt;/TouchableOpacity&gt;)<br>          })<br>        }<br>      &lt;/View&gt;</pre><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*6ptI5h1iwrtTwuxKG_Eflw.png" /></figure><p>Best Practice:</p><p>After playing with it for a while I noticed some caveats while using adjustsFontSizeToFit and this is prolly why it’s not documented yet.</p><p>I would get weird results when using certain styles in combination with the Text Component that include: fontSize, height, width, flex, and margin just to name a few, this will result in it it looking something the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*0Luicv06woJa_xZCloWNqQ.png" /><figcaption>When using adding {flex:1} to styles</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*Sl4RyJHSZBqL8Vta1UwrDA.png" /><figcaption>When declaring width (eg {width:50}) in styles</figcaption></figure><p>Hope this helps someone.</p><p>This is my first Medium blog post (my official blog is at <a href="http://vyga.io/blog">http://vyga.io/blog</a>) and I’d like to continue taking a deeper dive into some overlooked or area’s that are not discussed on other blogs in React Native, and that may weight on the success of this post, so if you this and/or this was helpful please say so in the comments and I’d love to do it again.</p><p>Also if I missed anything or if I could have done anything better let me know. Thanks again!</p><p>UPDATE:</p><p>See the React Native Text docs if this has updated by clicking below.</p><p><a href="https://facebook.github.io/react-native/docs/text.html#minimumfontscale">Text - React Native</a></p><p><strong>TLDR;</strong></p><p>Here are some updates I wanted to add as I found myself kept refering back to this and wanted a cheetsheet of sorts.</p><p>Use the following props in your Text components:</p><h3>1. First try adding the following style to your styles StyleSheet.create({})</h3><p>centerText:{<strong>textAlign:&quot;center&quot;,textAlignVertical:&quot;center&quot;},</strong></p><p>then use in style:</p><p><strong>EXAMPLE 1:</strong></p><p>&lt;Text style={[styles.centerText]}&gt;Am I centered?&lt;/Text&gt;</p><h3>2. Use adjustsFontSizeToFit</h3><p>And optionally use minimumFontScale (with value 0 to 1) in conjecture.</p><p><strong>EXAMPLE 2:</strong></p><p>&lt;Text adjustsFontSizeToFit minimumFontScale={.5}&gt;Am I centered?&lt;/Text&gt;</p><p><strong>Note:</strong></p><p>Notices confilcts when using the following styles:</p><p>fontSize, height, width, flex, margin</p><p>So first try omitting them.</p><h3>3. Use numberOfLines</h3><p>This will limit numbers of lines shown before truncated.</p><p><strong>EXAMPLE 3:</strong></p><p>&lt;Text numberOfLines={1}&gt;Limit to One Line!&lt;/Text&gt;</p><h3>4. Use allowFontScaling</h3><p>Specifies whether fonts should scale to respect Text Size accessibility settings.</p><p><strong>EXAMPLE 4:</strong></p><p>&lt;Text allowFontScaling&gt;Am I centered?&lt;/Text&gt;</p><h3>5. Clap if you liked this post.</h3><p>also to follow me on twitter at @vygaio or see my other medium account’s most I’m going to try to use more often <a href="https://medium.com/u/ac77d417f19e">ʇʇǝɹɹɐƃ</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f7d1d68305b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>