<?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 Haider ali on Medium]]></title>
        <description><![CDATA[Stories by Haider ali on Medium]]></description>
        <link>https://medium.com/@haider-rn?source=rss-3c76d70bd786------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Haider ali on Medium</title>
            <link>https://medium.com/@haider-rn?source=rss-3c76d70bd786------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 05:12:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@haider-rn/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[Testing JavaScript Code with Jest]]></title>
            <link>https://medium.com/@haider-rn/testing-javascript-code-with-jest-3e8b3eab31c0?source=rss-3c76d70bd786------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e8b3eab31c0</guid>
            <category><![CDATA[test]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[jest]]></category>
            <dc:creator><![CDATA[Haider ali]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 04:38:12 GMT</pubDate>
            <atom:updated>2026-10-13T04:38:12.692Z</atom:updated>
            <content:encoded><![CDATA[<h3>Get Started with Jest 🚀</h3><p>First thing first — let’s start your testing journey with <strong>Jest</strong>.</p><blockquote><strong><em>Jest is a delightful JavaScript Testing Framework with a focus on simplicity.</em></strong></blockquote><p>And trust me, your first test is much easier than it sounds. 😄</p><h3>Setting Up Jest</h3><p>First, create a folder with any name you like.</p><p>For example, I created: <strong>Practice-jest</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*0j0ns7iW3ACia7_PM27_3g.png" /></figure><p>Now open this folder inside <strong>VS Code</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*8e3krtQTd8aRUir42ho32g.png" /></figure><h3>Step 1 — Create package.json</h3><p>Before installing Jest, we need a package.json file.</p><p>Run this command in your terminal:</p><pre>npm init -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*u4lUBGjI6JU1d8IJrQWNAw.png" /></figure><p>npm is basically a <strong>package manager</strong> for JavaScript.</p><p>You can also use <strong>Yarn</strong> if you prefer:</p><pre>yarn init -y</pre><p>After running the command, you should see a package.json file inside your folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*n7pUZg1sTdE6ePkMyvUUWw.jpeg" /></figure><p>Great! 🎉</p><h3>Step 2 — Install Jest</h3><p>Now let’s install Jest.</p><p>Using npm:</p><pre>npm install --save-dev jest</pre><p>Or using Yarn:</p><pre>yarn add --dev jest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*G9BY236kny-vsEhEH2HE1g.png" /></figure><p>You can find the official Jest documentation here:</p><p><a href="https://jestjs.io/docs/getting-started">https://jestjs.io/docs/getting-started</a></p><p>Now, take a look at your package.json.</p><p>You should find Jest installed under:</p><pre>&quot;devDependencies&quot;</pre><p>like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vWnR_zcM42_2x6gm6AmZXw.png" /></figure><p>Great work! 🎉</p><p>Jest is now ready.</p><h3>Step 3 — Create a JavaScript Function</h3><p>Now let’s create a simple JavaScript function that we can test.</p><p>Create a new file called:<strong> sum.js</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*4AxC89MfPLdTWTAhtm8R_A.png" /></figure><p>Inside it, create a sum function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*ennE1U1lACwsGGMvSikoqQ.png" /></figure><p>But wait…</p><p>How will our test file access this function?</p><p>We need to <strong>export</strong> it.</p><p>Since we’re using JavaScript with CommonJS, add:</p><pre>module.exports = sum;</pre><p>So your complete sum.js should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*Hf1ZQW4ECNDOU3j5-JBTCQ.png" /></figure><p>If you don’t know what module.exports means yet, don&#39;t worry.</p><p>You can learn more about JavaScript modules and import/export here:</p><p><a href="https://www.w3schools.com/js/js_modules.asp">https://www.w3schools.com/js/js_modules.asp</a></p><h3>Step 4 — Create Your First Test File 🧪</h3><p>Now comes the exciting part.</p><p>Let’s create a file for testing.</p><p>Use the same name as your JavaScript file, but add .test before .js.</p><p>So:</p><pre>sum.js</pre><p>becomes:</p><pre>sum.test.js</pre><p>like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*LeTui_4ThBb3WGjmZMcIAA.png" /></figure><p>Your folder should now look something like:</p><pre>Practice-jest/<br>│<br>├── node_modules/<br>├── package.json<br>├── sum.js<br>└── sum.test.js<br>└── yarn.lock</pre><h3>Step 5 — Import the Function</h3><p>Now let’s import the sum function we created in sum.js.</p><p>Since we’re using JavaScript/CommonJS syntax:</p><pre>const sum = require(&#39;./sum&#39;);</pre><p>Now our test file knows about the sum function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*tl3oVO4RHmHCql-v-ioC9Q.png" /></figure><h3>Step 6 — Write Your First Test 🎯</h3><p>Jest provides a test block that we can use to create a test.</p><p>Its basic syntax looks like this:</p><pre>test(message, callback)</pre><p>Let’s break it down.</p><p>On the left side, we write a message describing what we’re testing.</p><p>For example:</p><pre>test(&quot;adds 1 + 2 to equal 3&quot;, callback)</pre><p>On the right side, we provide a <strong>callback function</strong>.</p><p>This is where our actual test will run.</p><p>So:</p><pre>test(&quot;adds 1 + 2 to equal 3&quot;, () =&gt; {<br>   <br>     // write your test case<br><br>});</pre><p>Pretty simple, right? 😄</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*x3ok3dWUG2LP1U6O2qfAMA.png" /></figure><h3>Step 7 — Use Jest Matchers</h3><p>Now we need a way to actually check whether our function is giving us the expected result.</p><p>This is where <strong>Jest matchers</strong> come in.</p><blockquote><em>Jest uses </em><strong><em>matchers</em></strong><em> to let you test values in different ways.</em></blockquote><p>You can learn more about Jest matchers here:</p><p><a href="https://jestjs.io/docs/using-matchers">https://jestjs.io/docs/using-matchers</a></p><p>For our sum function, we&#39;re going to use:</p><pre>expect()</pre><p>and:</p><pre>toBe()</pre><p>expect() returns an expectation object, while toBe() is the matcher we use to check the result.</p><p>Now let’s write our actual test:</p><pre>test(&quot;adds 1 + 2 to equal 3&quot;, () =&gt; {<br>  expect(sum(1, 2)).toBe(3);<br>});</pre><p>And that’s it! 🎉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*GtVURbizQwahXhiFCQfDoQ.png" /></figure><p>You just wrote your <strong>first Jest test case</strong>.</p><h3>What Does This Line Mean?</h3><p>Let’s break this down:</p><pre>expect(sum(1, 2)).toBe(3);</pre><p>We’re basically saying:</p><blockquote><em>“I expect the result of </em><em>sum(1, 2) to be </em><em>3.&quot;</em></blockquote><p>We pass 1 and 2 to our sum function:</p><pre>sum(1, 2)</pre><p>Our function returns:</p><pre>3</pre><p>Then Jest checks:</p><pre>.toBe(3)</pre><p>If the result is 3 → ✅ <strong>Test passes</strong></p><p>If the result is something else → ❌ <strong>Test fails</strong></p><h3>Step 8 — Add a Test Script</h3><p>We’re almost there!</p><p>Now we need a simple way to run our tests.</p><p>Open your package.json and add a test script:</p><pre>{<br>  &quot;scripts&quot;: {<br>    &quot;test&quot;: &quot;jest&quot;<br>  }<br>}</pre><p>Now your package.json can look something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*byCI9z1B3hZAA4MQ6EDmVg.png" /></figure><h3>Step 9 — Run Your First Test 🚀</h3><p>Now save all your files.</p><p>Open your terminal and run:</p><h3>Using npm</h3><pre>npm test</pre><h3>Or using Yarn</h3><pre>yarn test</pre><p>And now…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9hOnz4oHtK63W7i1017nw.png" /></figure><p>What do you get?</p><p><strong>PASS?</strong> 🎉</p><p>If your test passes, congratulations!</p><p>You just successfully wrote and ran your <strong>first JavaScript test using Jest</strong>.</p><h3>🎉 That’s It!</h3><p>You started with a simple JavaScript function:</p><pre>function sum(a, b) {<br>  return a + b;<br>}</pre><p>Then you created your first test:</p><pre>test(&quot;adds 1 + 2 to equal 3&quot;, () =&gt; {<br>  expect(sum(1, 2)).toBe(3);<br>});</pre><p>And finally, you ran it with:</p><pre>npm test</pre><p>If you see:</p><pre>PASS</pre><p>you did it! 🥳</p><p><strong>That’s your first test case.</strong></p><p>It might look small, but this is the beginning of your testing journey.</p><p>From here, you can start learning more about <strong>matchers, multiple test cases, </strong><strong>describe, </strong><strong>beforeEach, mocking, async testing, React Native testing, and eventually Appium/Jest automation.</strong></p><p>Welcome to testing! 🧪🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e8b3eab31c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Upgrade to sdk 36 React Native]]></title>
            <link>https://medium.com/@haider-rn/upgrade-to-sdk-36-react-native-a3c951ad76d3?source=rss-3c76d70bd786------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3c951ad76d3</guid>
            <dc:creator><![CDATA[Haider ali]]></dc:creator>
            <pubDate>Sat, 08 Aug 2026 07:04:16 GMT</pubDate>
            <atom:updated>2026-08-08T07:04:16.287Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Note:</strong> this guide is for react-native developer</p><p><strong>Date:</strong> August 7, 2026</p><h3><strong>What Changes need to be done ?</strong></h3><p>&gt; Upgrade target SDK to 36 across the Android codebase to maintain Play Store compliance and compatibility with newer Android OS versions.</p><p><strong>Why is this needed?</strong></p><p>Getting Warning from playconsole to upgrade your application sdk to 36</p><p><strong>ScreenShort:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*laFvDCQwwsSQxZr1CbvyJg.png" /></figure><h3><strong>Changes i do</strong></h3><p>Navigate to <strong>android/build.gradle</strong></p><p><strong>Update the</strong></p><p>&gt; buildToolsVersion from 35 to 36</p><p>&gt; compileSdkVersion from 35 to 36</p><p>&gt; targetSdkVersion from 35 to 36</p><h3><strong>Test the app</strong></h3><p>App get crash on veriff sdk launch with <strong><em>error</em></strong> in console java.lang.illegalArgumentException</p><p>⚠️ <strong>ScreenShort:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*bJvPfZBbLRqpVpeGsHe6jg.png" /></figure><p>Revert the changes and fixes in next steps</p><blockquote><strong>Step1:</strong> Just update compile and target sdk to version 36</blockquote><p>Navigate to <strong>android/build.gradle</strong></p><p><strong>Update the</strong></p><p>&gt; compileSdkVersion from 35 to 36<br>&gt; targetSdkVersion from 35 to 36</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*wW7Tm-2mNbFj1Trmt3SKxw.png" /></figure><blockquote><strong>Step2: </strong>Test the app still get crash on veriff launch also update the veriff version</blockquote><p>Navigate to <strong>package.json</strong></p><p>Update the veriff SDk to Version “11.2.0” Total Downloads <strong>60k+</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*N3Jsj4VCglEmqID5o7UGbg.png" /></figure><p>Also update the safe-area-context to Version “~5.7.0” Total Downloads <strong>2M+</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*WzcYsDkqArScTI3AYt81-w.png" /></figure><blockquote><strong>Step3: </strong>again test the changes all sdk working</blockquote><p>&gt; Veriff launch ✅</p><blockquote><strong>Step4:</strong> using adb, extract the app sdk version getting 36 which we want</blockquote><p>Device on which Testing Perform</p><p>Name: Samsung</p><p>Version: android 16 version36</p><h3>⚠️ <strong>NEW ISSUE AFTER APP TARGET SDK 36</strong></h3><p>The <strong>modal and bottom sheet </strong>get closed on pressing back gesture and not open again don’t now why. means it just disturb the normal app flow</p><p>Here in this docs mention what android 36 changes: <a href="https://developer.android.com/about/versions/16/behavior-changes-16">docs link</a></p><blockquote>The main issue is of <a href="https://developer.android.com/about/versions/16/behavior-changes-16#predictive-back"><strong>predictive back</strong></a></blockquote><p>For the provided solution by developer.android just make the <a href="https://developer.android.com/guide/topics/manifest/activity-element#enableOnBackInvokedCallback"><strong>android:enableOnBackInvokedCallback</strong></a> to false to make the app back icon behaviour work as previous</p><p>Navigate to <strong>android/app/src/main/AndroidManifest.xml</strong></p><p>Inside <strong>&lt;application&gt;</strong> tag added the attribute</p><p>So the changes look like</p><p><strong>&lt;application</strong> <a href="https://developer.android.com/guide/topics/manifest/activity-element#enableOnBackInvokedCallback">android:enableOnBackInvokedCallback</a>=”false”<strong> &gt;</strong></p><p>Again test the app working as normal now. ✅</p><h3><strong>Get approval from Playstore:</strong></h3><p>Submit and get clearance from playstore</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3c951ad76d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native Raw Bottom Sheet with Auto Height Calculation]]></title>
            <link>https://medium.com/@haider-rn/react-native-raw-bottom-sheet-with-auto-height-calculation-3db3b7e1a714?source=rss-3c76d70bd786------2</link>
            <guid isPermaLink="false">https://medium.com/p/3db3b7e1a714</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[raw-bottom-sheet]]></category>
            <category><![CDATA[auto-height-bottom-sheet]]></category>
            <category><![CDATA[raw-bottom-sheet-height]]></category>
            <dc:creator><![CDATA[Haider ali]]></dc:creator>
            <pubDate>Sat, 15 Nov 2025 17:09:38 GMT</pubDate>
            <atom:updated>2025-11-15T17:09:38.496Z</atom:updated>
            <content:encoded><![CDATA[<p>While working on my React Native project, I used <strong>RBSheet</strong> to display a contact support modal as a bottom sheet. Everything looked great during development, but when I tested the feature on different devices, I ran into a height issue: parts of the content were cut off on some screens (as shown in the screenshot).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*-HxhyF93uxi8Sy_wbsF5sg.png" /></figure><p>To fix this, I wanted the <strong>RBSheet</strong> to automatically adjust its height based on the actual content size so it would appear consistently and fully visible across all devices.</p><p>Initially, I was using the RBSheet component like this:</p><pre>&lt;RBSheet<br>        ref={refRBSheet}<br>        height={height ?? screenHeight - 320}<br>        onOpen={onOpen}<br>        onClose={onClose}<br>        customStyles={{<br>          wrapper: {<br>            backgroundColor: overi,<br>          },<br>          container: {<br>            borderTopLeftRadius: 20,<br>            borderTopRightRadius: 20,<br>            backgroundColor: backgroundColor,<br>            paddingHorizontal: 10,<br>          },<br>        }}<br>        {...props}<br>      &gt;<br>        {children}<br>      &lt;/RBSheet&gt;</pre><h3>Auto Height Bottom Sheet</h3><p>To make it <strong>auto-adjust the height</strong> based on content, add a state variable and use the onLayout callback to capture the rendered height:</p><pre> const [sheetHeight, setSheetHeight] = useState(undefined);<br><br>&lt;View onLayout={(e) =&gt; {setSheetHeight(e.nativeEvent.layout.height)}}&gt;<br>&lt;/View&gt;</pre><p>Then, pass this sheetHeight value to your container style:</p><pre>container: {<br>            borderTopLeftRadius: 20,<br>            borderTopRightRadius: 20,<br>            backgroundColor: backgroundColor,<br>            paddingHorizontal: 10,<br>+           height: sheetHeight,<br>          },</pre><p>Your final <strong>RBSheet</strong> will look like this:</p><pre>&lt;RBSheet<br>        ref={refRBSheet}<br>        onOpen={onOpen}<br>        onClose={onClose}<br>        customStyles={{<br>          wrapper: {<br>            backgroundColor: overi,<br>          },<br>          container: {<br>            borderTopLeftRadius: 20,<br>            borderTopRightRadius: 20,<br>            backgroundColor: backgroundColor,<br>            paddingHorizontal: 10,<br>            height: sheetHeight,<br>          },<br>        }}<br>        {...props}<br>      &gt;<br>      &lt;View onLayout={(e) =&gt; {setSheetHeight(e.nativeEvent.layout.height)}}&gt;<br>        {children}<br>      &lt;/View&gt;<br>      &lt;/RBSheet&gt;</pre><p>With this simple approach, your bottom sheet dynamically adapts to its content size, ensuring a smooth and consistent UI across all devices.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3db3b7e1a714" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[⚠️source.uri should not be an empty string]]></title>
            <link>https://medium.com/@haider-rn/%EF%B8%8Fsource-uri-should-not-be-an-empty-string-411189c44839?source=rss-3c76d70bd786------2</link>
            <guid isPermaLink="false">https://medium.com/p/411189c44839</guid>
            <category><![CDATA[source-uri-warn]]></category>
            <category><![CDATA[image-component]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[image]]></category>
            <dc:creator><![CDATA[Haider ali]]></dc:creator>
            <pubDate>Sat, 08 Nov 2025 17:41:08 GMT</pubDate>
            <atom:updated>2025-11-09T14:02:42.503Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m currently developing a React Native application that displays a list of items fetched from the backend. Each item contains a title, a color, and an image URL. However, some records return an empty string for the image URL, which triggers a console warning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*C7EvsDlNVIBK3iG468rovQ.png" /></figure><p>For example, the API returns something like:</p><pre>const myData = [<br>{ <br> title: &quot;medium&quot;, <br> color: &quot;#000&quot;,<br> ImageUrl: &quot;https://ln.run/-rKjH&quot;,<br>},<br>{ <br> title: &quot;Youtube&quot;,<br> color: &quot;red&quot;,<br> ImageUrl: &quot;&quot;,<br>},<br>]</pre><p>And my FlatList implementation looks like this:</p><pre> &lt;Flatlist<br>          data={myData}<br>          style={styles.gridView}<br>          showsVerticalScrollIndicator={false}<br>          spacing={10}<br>          renderItem={({ item }) =&gt; (<br>            &lt;View style={{ backgroundColor: item.color }} &gt;<br>              &lt;Image<br>                style={{<br>                  height: 60,<br>                  width: 60,<br>                  borderRadius: 50,<br>                }}<br>                source={{ uri: item.ImageUrl}}<br>              /&gt;<br>              &lt;Text style={styles.itemName}&gt;{item.title}&lt;/Text&gt;<br>            &lt;/View&gt;<br>          )}<br>        /&gt;</pre><h4>✅ <strong>Solution to remove the warning</strong></h4><p>To avoid the warning, only load the image when a valid URL exists.<br> If the URL is empty, simply don’t pass it to the Image component.</p><p><strong>Option 1</strong></p><pre> &lt;Image<br>    style={{ height: 60, width: 60, borderRadius: 50}}<br>   source={{ uri: item.uri ? item.uri : undefined }}<br>  /&gt;</pre><p><strong>Option 2</strong></p><pre>&lt;Image<br>    style={{ height: 60, width: 60, borderRadius: 50}}<br>   source={item.uri ? { uri: item.uri} : undefined }<br>  /&gt;</pre><p>Both approaches will prevent the warning from appearing and ensure the app works smoothly.</p><p>If you find this helpful, show some love so I can write more content like that.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=411189c44839" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[App must support a 16KB memory page size | React Native]]></title>
            <link>https://medium.com/@haider-rn/app-must-support-a-16kb-memory-page-size-react-native-619a574941db?source=rss-3c76d70bd786------2</link>
            <guid isPermaLink="false">https://medium.com/p/619a574941db</guid>
            <category><![CDATA[support-app-16kb]]></category>
            <category><![CDATA[16kb-issue]]></category>
            <category><![CDATA[16-kb-page-size]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[expo]]></category>
            <dc:creator><![CDATA[Haider ali]]></dc:creator>
            <pubDate>Tue, 14 Oct 2025 15:51:23 GMT</pubDate>
            <atom:updated>2025-10-14T15:51:23.557Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi, I recently published two apps on the Google Play Store — one built with core React Native and the other with React Native + Expo. Both apps are showing me the same alert (see attached screenshot).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cAO6N60g4R7QHFaTpkVWBA.png" /><figcaption>16KB memory size</figcaption></figure><p>After some research, I found in the official Android docs that from November 1st, 2025, all new apps and updates on Google Play targeting Android 15 or higher must support 16 KB page sizes on 64-bit devices. (<a href="https://developer.android.com/guide/practices/page-sizes">Link</a>)</p><h3>STEPS TO SOLVE THIS</h3><p>Without wasting your time, I’ll show you how to fix this alert — or in other words, how to make your Expo or React Native app support 16 KB page sizes. In this tutorial, I’ll be using two apps: one built with core React Native and another with React Native + Expo.</p><h4>STEP 1: Make a Build</h4><p>The first step is to create an APK build of your app. Navigate to your project’s <strong>Android</strong> directory:</p><p>cd android</p><p>Then run the following commands to clean and build the release version:</p><p>./gradlew clean<br>./gradlew assembleRelease</p><pre>haider@haider-Lenovo-V14-G3-IAP:~ /PizzaApp$ cd android<br>haider@haider-Lenovo-V14-G3-IAP:~ /PizzaApp/android$ ./gradlew clean<br>haider@haider-Lenovo-V14-G3-IAP:~ /PizzaApp/android$ ./gradlew assembleRelease</pre><p>Or, if you’re using Fastlane to create builds, use the following command.<br>android fastlane beta</p><pre>haider@haider-Lenovo-V14-G3-IAP:~ /PizzaApp$ cd android<br>haider@haider-Lenovo-V14-G3-IAP:~ /PizzaApp/android$ android fastlane beta</pre><p>After the build is completed, you can find your APK in the following location within your project.<br>/PizzaApp/android/app/build/outputs/apk/release/app-release.apk</p><h4>STEP 2: Identify native libraries using APK Analyzer</h4><p>Open Android Studio — in my case, I’m using Android Studio Narwhal Feature Drop | 2025.1.2 Canary 8.</p><ol><li>On the top right, you’ll see the “Open” label — click on it.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_u35cFv7ftFQmpjwiTtUyQ.jpeg" /></figure><p>2. A pop-up will appear asking you to open your project. Select the location where your APK build was created — in my case, it’s at /PizzaApp/android/app/build/outputs/apk/release/app-release.apk — and then click “OK.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*rMV_by42CUhDIU_qafh2ZQ.png" /></figure><p>3. When you click “OK,” Android Studio might ask whether you want to stay in Light Edit mode or open the project. The choice is yours — I personally selected “Stay in Light Edit.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*E7HXN-Ytf4VHazIlkBFXmg.png" /></figure><p>4. After that, Android Studio automatically detects the native libraries that don’t support 16 KB page sizes. It shows an alert saying “4 KB load section alignment, but 16 KB is required.” (Screenshot attached)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*G_AlUYBI3-cO4DWIi8VdIw.png" /></figure><h4>STEP 3: Help from AI</h4><p>Just copy the <strong>.so</strong> files that show the error <em>“4kB load section alignment, but 16KB is required.”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bqpU9_FEnwoV7O9xs-eGew.png" /><figcaption>4kb aligment</figcaption></figure><p>In my first app, which is built with <strong>core React Native</strong>, <strong>four .so files</strong> don’t support 16KB, as shown in the previous screenshot:</p><ul><li>libreanimated.so</li><li>libworklets.so</li><li>librnscreens.so</li><li>libtool-checker.so</li></ul><p>In my second app, which is built with <strong>React Native and Expo</strong>, <strong>three .so files</strong> don’t support 16KB:</p><ul><li>libreanimated.so</li><li>libworklets.so</li><li>libexpo-modules-core.so</li></ul><p>After copying the <strong>.so</strong> files and your <strong>package.json</strong> dependencies, paste them into any AI tool — I personally prefer <strong>ChatGPT</strong> — and ask which <strong>.so</strong> file belongs to which package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*A9o3TCeyfWCAryfohxx_pg.png" /></figure><p>As you can see in the above screenshot, ChatGPT provided a summary table that clearly shows which .so File belongs to which package?<br>The next step is to <strong>update the respective packages</strong> to ensure compatibility with the latest Android 16KB page size requirement.</p><h4><strong>Step 4: Update Packages</strong></h4><ol><li><strong>Updating pkg for core React native app:-</strong></li></ol><p>First, ensure that you’re using <strong>React Native version 0.77 or higher</strong>, as this version officially supports Android’s <strong>16KB page size</strong> requirement. In both of my apps, I’m already using React Native 0.77, but as you can see, some packages still don’t support 16KB — so I needed to update them.</p><p>For my <strong>core React Native app</strong>, I updated the packages (as shown in the attached screenshot).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4mKfCA723Wrr74U-NFWYfg.png" /><figcaption>updated packges</figcaption></figure><p>After that, I repeated <strong>Step 1</strong> and <strong>Step 2</strong>. If you still encounter the <strong>4KB alignment error</strong>, update the related packages once more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cvlSghHYVVqre1_llz0JAw.png" /></figure><p>In my case, after updating, I no longer saw the error in the <strong>Analyzer</strong>, as shown in the attached screenshot.</p><p><strong>2. Updating pkg for Expo and React native app:-</strong></p><p>Now, it’s time to update the <strong>second app</strong>, which uses <strong>Expo</strong>.<br>In this app, the main issue occurred while updating the <strong>expo-modules-core</strong> package.</p><p>I was using:</p><ul><li>&quot;expo&quot;: &quot;~52.0.7&quot;</li><li>&quot;expo-modules-core&quot;: &quot;2.2.3&quot;</li></ul><p>When I tried to update <strong>expo-modules-core</strong>, it became incompatible with my current Expo version and <strong>expo-modules-autolinking</strong> (a dev dependency). I attempted to fix it, but eventually decided it was time to update all related packages.</p><p>So, I upgraded:</p><ul><li><strong>React Native</strong> from 0.77.0 → 0.79.5</li><li><strong>Expo</strong> from 52.0.7 → 53.0.15</li></ul><p>These versions are among the <strong>most stable releases</strong> for React Native and Expo.<br> I recommend you do the same — and if you need help upgrading your React Native version, you can use the <a href="https://react-native-community.github.io/upgrade-helper/"><strong>React Native Upgrade Helper</strong>.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wsLrzNOQT9dyqC34aPXuRA.png" /><figcaption>upgrade helper</figcaption></figure><p>After updating all the app packages, I repeated <strong>Step 1</strong> and <strong>Step 2</strong>, and this time, I no longer saw the <strong>4KB alignment error</strong> in the <strong>Analyzer</strong>.</p><h4><strong>Step 5: Testing</strong></h4><p>The most important step after making any changes or updating packages in your app is <strong>testing</strong>.<br>Always test your app thoroughly to ensure everything works as expected. You can perform <strong>automated testing</strong> using tools like <strong>Appium</strong> or any other testing library you prefer — along with <strong>user testing</strong> to validate the real-world experience.<br><em>If you’re not sure how to perform testing using </em><strong><em>Appium</em></strong><em> with </em><strong><em>React Native</em></strong><em> apps, you can </em><strong><em>hire me</em></strong><em> as your </em><strong><em>automated app tester</em></strong><em> — or simply </em><strong><em>leave a comment below this story</em></strong><em>, and I’ll be happy to </em><strong><em>guide you through the process</em></strong><em>.</em></p><h4><strong>Step 6: Submit the app</strong></h4><p>The final step comes when you believe your app is completely ready for users. Simply <strong>submit your app to the Play Store</strong> and wait for approval. Once your app is approved, you’ll receive a message confirming that <strong>your app supports 16KB devices</strong>. (Screenshot Attached)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*nVAEvukP2s3DzRI6m6iwdQ.png" /><figcaption>support 16Kb</figcaption></figure><h4><strong>Extras:</strong></h4><p>If you want to <strong>test your own app</strong> to ensure it supports the <strong>16KB page size</strong>, there are two options available:<br><strong>1) Android Studio</strong><br>You can use any emulator in <strong>Android Studio</strong> that provides a <strong>pre-release version</strong> of devices with <strong>16KB page size</strong> support.<br>In my case, I tested my app on a <strong>Google Pixel 9a emulator</strong> running a <strong>pre-release version</strong> with 16KB page size support.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*CIM9fCc_goOZKbkmD4qFCg.png" /></figure><p><strong>2) Samsung Remote Test Lab</strong><br>If you’re familiar with <a href="https://developer.samsung.com/remotetestlab/devices/129/16kb-page-size"><strong>Samsung’s Remote Test Lab</strong></a>, you can use their <strong>16KB page size devices</strong> for testing.<br>Recently, Samsung has added the <strong>Galaxy A56 5G</strong> device with <strong>16KB page size support</strong>, which you can use to verify your app’s compatibility.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vq8S40838sPZyAz-67eTsQ.png" /></figure><p>THE END 🙂</p><p>If you enjoyed this post, please <strong>show your support</strong> — it encourages me to <strong>write more helpful content like this</strong> in the future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=619a574941db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Patch a Package in React native]]></title>
            <link>https://medium.com/@haider-rn/patch-a-package-in-recat-native-01cff75feee6?source=rss-3c76d70bd786------2</link>
            <guid isPermaLink="false">https://medium.com/p/01cff75feee6</guid>
            <category><![CDATA[patch-package]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[patch]]></category>
            <category><![CDATA[deprecated-package]]></category>
            <dc:creator><![CDATA[Haider ali]]></dc:creator>
            <pubDate>Thu, 09 Oct 2025 07:25:21 GMT</pubDate>
            <atom:updated>2025-10-10T05:15:54.927Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, I upgraded my React Native version from <strong>0.77.0</strong> to <strong>0.79.5</strong>. I was using the package <strong>react-native-pin-view</strong>, which worked perfectly fine with React Native <strong>0.77.0</strong>, but after the upgrade, it started throwing errors. Even though I’m using its latest official version, the package is now <strong>deprecated</strong>.</p><p>So, I had two options — either switch to a different package or <strong>patch</strong> the existing one. I decided to patch it instead.<br> In this tutorial, I’ll show you <strong>how you can patch any React Native package</strong> easily.</p><h4><strong>Step 1: Install packages</strong></h4><p>Install patch-package and postinstall-prepare packages</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*_mEzkyHkQddO1b232S_Wbw.png" /><figcaption>packages</figcaption></figure><p>These packages allow you to <strong>create</strong>, <strong>apply</strong>, and <strong>automatically reapply patches</strong> for any npm dependency after each installation.</p><h4><strong>Step 2: Patch applied automatically</strong></h4><p>To make sure your patch is applied automatically every time dependencies are installed,<br>add the following <strong>postinstall</strong> script inside your <strong>package.json</strong> file:<br>“postinstall”: “node ./bin/postInstall”,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*87bFqowXM5ubOWnzBqcQKg.png" /></figure><h4><strong>Step 3: Make modifications</strong></h4><p>To modify the package, navigate to the file or component <strong>where the package is imported</strong> in your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*H5jqATQ2GQwxWgcxU00TaQ.png" /><figcaption>Packge import</figcaption></figure><p>From there, you can easily locate and edit the package’s source files — simply <strong>hold Ctrl (or Command on Mac) and click</strong> on the package name to open its source code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*CteTb5h93JO-ErNt86dffg.png" /><figcaption>SOURCE FILE OF PIN VIEW</figcaption></figure><p>As you can see in the previous screenshot, I’ve opened the source file of the <strong>PinView</strong> package.<br>Now, it depends on what changes you need to make — in my case, I just needed to <strong>update the way props were being called</strong>, which was causing the error.</p><h4><strong>Step 4: Confirm Changes work or not</strong></h4><p>In my case, I modified the <strong>index.js</strong> file of the package to ensure the updated prop-calling logic was applied.<br> To see which files are included in your package, simply <strong>click on the package folder</strong> — this will display all of its source code files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*CHzeBvNcRrGOTXmuNvpbRQ.png" /></figure><p>After making the changes, ensure that everything works correctly and that your app doesn’t display any <strong>crashes</strong>, <strong>errors</strong>, or <strong>alerts</strong>.</p><h4><strong>Step 5: Generate Patch File</strong></h4><p>Finally, after making the changes, simply run this command in your terminal. Screenshot attached</p><p>npx patch-package &lt;package-name&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*j-Xgz0oBWKts-UGOWxbvTQ.png" /><figcaption>patch pkg</figcaption></figure><p>After running this command, a <strong>patches</strong> folder will be created in your project root.<br>Inside it, you’ll find a file with the <strong>name of the package you modified</strong>, containing all your changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*dj_5zT65UGu8nekDnX395A.png" /></figure><p>That&#39;s it.</p><p>Thanks for reading this blog. If you like this, encourage me so I can write more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01cff75feee6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Switch to Expo Go in ignite-Cli React Native BoilerPlate]]></title>
            <link>https://medium.com/@haider-rn/remove-mmkv-in-ignite-cli-react-native-boilerplate-dc95e56b5b75?source=rss-3c76d70bd786------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc95e56b5b75</guid>
            <category><![CDATA[expo-go]]></category>
            <category><![CDATA[ignite-cli]]></category>
            <category><![CDATA[aysnc-storage]]></category>
            <category><![CDATA[mmkv-instance]]></category>
            <category><![CDATA[remove-mmkv]]></category>
            <dc:creator><![CDATA[Haider ali]]></dc:creator>
            <pubDate>Sun, 05 Oct 2025 11:48:22 GMT</pubDate>
            <atom:updated>2025-10-24T13:37:48.294Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi, I’m a React Native developer, and I’ve been using <strong>ignite-cli</strong> for a long time to build awesome apps. Up until now, I was mostly using the <strong>development build</strong> to create my apps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*FHl9jyvgPE53MrVfWPB5QA.png" /><figcaption>Using Development Build</figcaption></figure><p>Recently, I decided to start a new project using <strong>Expo Go</strong> instead of the development build. For that, I just pressed &quot;s&quot; In the terminal to switch to Expo Go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*HmoTQmMEG5jCwdUNKU_TDA.png" /><figcaption>using expo go</figcaption></figure><p>The switch worked, but when I ran the app in the emulator, I got an <strong>MMKV error</strong> (screenshot attached).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*qm8EpynbegV-Q8BVQKFsqA.png" /><figcaption>MMKV ERROR</figcaption></figure><p>After some research, I found out that <strong>Expo Go does not support MMKV</strong> (reference: <a href="https://stackoverflow.com/questions/79277941/nobridge-error-failed-to-create-a-new-mmkv-instance-with-react-native-mmkv-in">StackOverflow 🔗</a>).</p><h4><strong>Remove MMKV From Ignite</strong></h4><p>So, my next step was to check the <strong>ignite-cli cookbook</strong> for a solution. I found the recipe <a href="https://ignitecookbook.com/docs/recipes/SwitchBetweenExpoGoCNG/#expo-go---expo-cng"><em>“Switch Between Expo Go and Expo CNG”</em>,</a> but it seems to be outdated compared to the latest ignite-cli boilerplate.<br>Now, I’m trying to replace <strong>MMKV</strong> with <strong>Async Storage</strong>, since Expo Go supports Async Storage. Maybe you can walk through the steps with me to get rid of MMKV and make the app run smoothly with Async Storage.</p><h4><strong>Step 1:</strong></h4><p>Update package.json scripts<br>Modify your Android and iOS script (screenshot attached).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uSveWV4jL2s7tlQuzLkV8Q.png" /></figure><h4><strong>Step 2:</strong></h4><p>Remove native directories if you have any <br>Just run this command in the terminal: rm -rf android ios</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*9Fyz1hswukpNKt_TykV8rA.png" /></figure><h4><strong>Step 3:</strong></h4><p>Remove and install packages<br>remove react-native-mmkv and react-native-keyboard-controller</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ubCOiy1DFc2kavwePGRSsA.png" /></figure><p>install @react-native-async-storage/async-storage and expo-status-bar</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*coJPY0yHu1jM6E9tNzEJEg.png" /></figure><h4><strong>Step 4:</strong></h4><p>Update your storage utility in app/utils/storage/index.ts using the code I shared below. Alternatively, you can refer to the <a href="http://react-native-async-storage.github.io/async-storage/docs/install/">official Async Storage documentation </a>and update the storage implementation based on your project requirements.</p><pre>import AsyncStorage from &quot;@react-native-async-storage/async-storage&quot;<br><br>/**<br> * Loads a string from storage.<br> * <br> * @param key The key to fetch.<br> */<br>export async function loadString(key: string) {<br>  try {<br>    return await AsyncStorage.getItem(key) ?? null<br>  } catch {<br>    // not sure why this would fail... even reading the RN docs I&#39;m unclear<br>    return null<br>  }<br>}<br><br>/**<br> * Saves a string to storage.<br> *<br> * @param key The key to fetch.<br> * @param value The value to store.<br> */<br>export function saveString(key: string, value: string): boolean {<br>  try {<br>    AsyncStorage.setItem(key, value)<br>    return true<br>  } catch {<br>    return false<br>  }<br>}<br><br>/**<br> * Loads something from storage and runs it thru JSON.parse.<br> *<br> * @param key The key to fetch.<br> */<br>export async function load&lt;T&gt;(key: string){<br>  let almostThere: string | null = null<br>  try {<br>     const jsonValue = await AsyncStorage.getItem(key);<br>    return jsonValue != null ? JSON.parse(jsonValue) : null;<br>  } catch {<br>    return (almostThere as T) ?? null<br>  }<br>}<br><br>/**<br> * Saves an object to storage.<br> *<br> * @param key The key to fetch.<br> * @param value The value to store.<br> */<br>export async function save(key: string, value: unknown) {<br>  try {<br>    const jsonValue = JSON.stringify(value)<br>    await AsyncStorage.setItem(key, jsonValue)<br>    return true<br>  } catch {<br>    return false<br>  }<br>}<br><br>/**<br> * Removes something from storage.<br> *<br> * @param key The key to kill.<br> */<br>export function remove(key: string): void {<br>  try {<br>    AsyncStorage.removeItem(key)<br>  } catch {}<br>}<br><br>/**<br> * Burn it all to the ground.<br> */<br>export function clear(): void {<br>  try {<br>    AsyncStorage.clear()<br>  } catch {}<br>}</pre><p>Next, update your theme context in app/theme/context.tsx. To do this, first create a custom hook inside app/utils/storage/ (you can name it anything you prefer — in this example, I’ll use usePersistedString.ts). Then, add the following code snippet inside the custom hook you just created.</p><pre>import { useState, useEffect, useCallback } from &quot;react&quot;<br>import { loadString, remove, saveString } from &quot;@/utils/storage&quot;<br><br>// custom hook to persist a string value in AsyncStorage<br>export function usePersistedString(key: string, initialValue?: string) {<br>  const [value, setValue] = useState&lt;string | undefined&gt;(initialValue)<br><br>  useEffect(() =&gt; {<br>    loadString(key).then((storedValue) =&gt; {<br>      if (storedValue !== null) setValue(storedValue)<br>    })<br>  }, [key])<br><br>  const setPersistedValue = useCallback(<br>    async (newValue: string | undefined) =&gt; {<br>      setValue(newValue)<br>      if (newValue === undefined) {<br>        await remove(key)<br>      } else {<br>        await saveString(key, newValue)<br>      }<br>    },<br>    [key],<br>  )<br><br>  return [value, setPersistedValue] as const<br>}</pre><p>Now, inside your app/theme/context.tsx</p><pre>//replace this line<br>-- import { useMMKVString } from &quot;react-native-mmkv&quot;<br>-- import { storage } from &quot;@/utils/storage&quot;<br>-- const [themeScheme, setThemeScheme] = useMMKVString(&quot;ignite.themeScheme&quot;, storage)<br><br>// With your custom hook<br><br>++ import { usePersistedString } from &quot;@/utils/storage/usePersistedString&quot;<br>++ const [themeScheme, setThemeScheme] = usePersistedString(&quot;ignite.themeScheme&quot;)</pre><h4><strong>Step 5:</strong></h4><ol><li>Remove the &lt;KeyboardProvider&gt; in app/app.tsx</li></ol><pre>-import { KeyboardProvider } from &quot;react-native-keyboard-controller&quot;<br><br>return (<br>  &lt;SafeAreaProvider initialMetrics={initialWindowMetrics}&gt;<br>--     &lt;KeyboardProvider&gt;<br>        &lt;ThemeProvider&gt;<br>          &lt;AppNavigator<br>            linking={linking}<br>            initialState={initialNavigationState}<br>            onStateChange={onNavigationStateChange}<br>          /&gt;<br>        &lt;/ThemeProvider&gt;<br>--      &lt;/KeyboardProvider&gt;<br>    &lt;/SafeAreaProvider&gt;<br>)</pre><p>2. Update your screen component in app/components/Screen.tsx with this code</p><pre>import { ReactNode, useRef, useState } from &quot;react&quot;<br>import { useScrollToTop } from &quot;@react-navigation/native&quot;;<br>import { StatusBar, StatusBarProps, StatusBarStyle } from &quot;expo-status-bar&quot;;<br>import {<br>  KeyboardAvoidingView,<br>  KeyboardAvoidingViewProps,<br>  LayoutChangeEvent,<br>  Platform,<br>  ScrollView,<br>  ScrollViewProps,<br>  StyleProp,<br>  View,<br>  ViewStyle,<br>} from &quot;react-native&quot;<br>import { useAppTheme } from &quot;@/theme/context&quot;<br>import { $styles } from &quot;@/theme/styles&quot;<br>import { ExtendedEdge, useSafeAreaInsetsStyle } from &quot;@/utils/useSafeAreaInsetsStyle&quot;<br><br><br>interface BaseScreenProps {<br>  /**<br>   * Children components.<br>   */<br>  children?: ReactNode<br>  /**<br>   * Style for the outer content container useful for padding &amp; margin.<br>   */<br>  style?: StyleProp&lt;ViewStyle&gt;;<br>  /**<br>   * Style for the inner content container useful for padding &amp; margin.<br>   */<br>  contentContainerStyle?: StyleProp&lt;ViewStyle&gt;<br>  /**<br>   * Override the default edges for the safe area.<br>   */<br>  safeAreaEdges?: ExtendedEdge[]<br>  /**<br>   * Background color<br>   */<br>  backgroundColor?: string<br>  /**<br>   * Status bar setting. Defaults to dark.<br>   */<br>  statusBarStyle?: StatusBarStyle;<br>  /**<br>   * By how much should we offset the keyboard? Defaults to 0.<br>   */<br>  keyboardOffset?: number<br>  /**<br>   * Pass any additional props directly to the StatusBar component.<br>   */<br>  StatusBarProps?: StatusBarProps;<br>  /**<br>   * Pass any additional props directly to the KeyboardAvoidingView component.<br>   */<br>  KeyboardAvoidingViewProps?: KeyboardAvoidingViewProps<br>}<br><br>interface FixedScreenProps extends BaseScreenProps {<br>  preset?: &quot;fixed&quot;<br>}<br>interface ScrollScreenProps extends BaseScreenProps {<br>  preset?: &quot;scroll&quot;<br>  /**<br>   * Should keyboard persist on screen tap. Defaults to handled.<br>   * Only applies to scroll preset.<br>   */<br>  keyboardShouldPersistTaps?: &quot;handled&quot; | &quot;always&quot; | &quot;never&quot;<br>  /**<br>   * Pass any additional props directly to the ScrollView component.<br>   */<br>  ScrollViewProps?: ScrollViewProps<br>}<br><br>interface AutoScreenProps extends Omit&lt;ScrollScreenProps, &quot;preset&quot;&gt; {<br>  preset?: &quot;auto&quot;<br>  /**<br>   * Threshold to trigger the automatic disabling/enabling of scroll ability.<br>   * Defaults to `{ percent: 0.92 }`.<br>   */<br>  scrollEnabledToggleThreshold?: { percent?: number; point?: number }<br>}<br><br>export type ScreenProps = ScrollScreenProps | FixedScreenProps | AutoScreenProps<br><br>const isIos = Platform.OS === &quot;ios&quot;<br><br>type ScreenPreset = &quot;fixed&quot; | &quot;scroll&quot; | &quot;auto&quot;<br><br>/**<br> * @param {ScreenPreset?} preset - The preset to check.<br> * @returns {boolean} - Whether the preset is non-scrolling.<br> */<br>function isNonScrolling(preset?: ScreenPreset) {<br>  return !preset || preset === &quot;fixed&quot;<br>}<br><br>/**<br> * Custom hook that handles the automatic enabling/disabling of scroll ability based on the content size and screen size.<br> * @param {UseAutoPresetProps} props - The props for the `useAutoPreset` hook.<br> * @returns {{boolean, Function, Function}} - The scroll state, and the `onContentSizeChange` and `onLayout` functions.<br> */<br>function useAutoPreset(props: AutoScreenProps): {<br>  scrollEnabled: boolean<br>  onContentSizeChange: (w: number, h: number) =&gt; void<br>  onLayout: (e: LayoutChangeEvent) =&gt; void<br>} {<br>  const { preset, scrollEnabledToggleThreshold } = props<br>  const { percent = 0.92, point = 0 } = scrollEnabledToggleThreshold || {}<br><br>  const scrollViewHeight = useRef&lt;null | number&gt;(null)<br>  const scrollViewContentHeight = useRef&lt;null | number&gt;(null)<br>  const [scrollEnabled, setScrollEnabled] = useState(true)<br><br>  function updateScrollState() {<br>    if (scrollViewHeight.current === null || scrollViewContentHeight.current === null) return<br><br>    // check whether content fits the screen then toggle scroll state according to it<br>    const contentFitsScreen = (function () {<br>      if (point) {<br>        return scrollViewContentHeight.current &lt; scrollViewHeight.current - point<br>      } else {<br>        return scrollViewContentHeight.current &lt; scrollViewHeight.current * percent<br>      }<br>    })()<br><br>    // content is less than the size of the screen, so we can disable scrolling<br>    if (scrollEnabled &amp;&amp; contentFitsScreen) setScrollEnabled(false)<br><br>    // content is greater than the size of the screen, so let&#39;s enable scrolling<br>    if (!scrollEnabled &amp;&amp; !contentFitsScreen) setScrollEnabled(true)<br>  }<br><br>  /**<br>   * @param {number} w - The width of the content.<br>   * @param {number} h - The height of the content.<br>   */<br>  function onContentSizeChange(w: number, h: number) {<br>    // update scroll-view content height<br>    scrollViewContentHeight.current = h<br>    updateScrollState()<br>  }<br><br>  /**<br>   * @param {LayoutChangeEvent} e = The layout change event.<br>   */<br>  function onLayout(e: LayoutChangeEvent) {<br>    const { height } = e.nativeEvent.layout<br>    // update scroll-view  height<br>    scrollViewHeight.current = height<br>    updateScrollState()<br>  }<br><br>  // update scroll state on every render<br>  if (preset === &quot;auto&quot;) updateScrollState()<br><br>  return {<br>    scrollEnabled: preset === &quot;auto&quot; ? scrollEnabled : true,<br>    onContentSizeChange,<br>    onLayout,<br>  }<br>}<br><br>/**<br> * @param {ScreenProps} props - The props for the `ScreenWithoutScrolling` component.<br> * @returns {JSX.Element} - The rendered `ScreenWithoutScrolling` component.<br> */<br>function ScreenWithoutScrolling(props: ScreenProps) {<br>  const { style, contentContainerStyle, children } = props<br>  return (<br>    &lt;View style={[$outerStyle, style]}&gt;<br>      &lt;View style={[$innerStyle, contentContainerStyle]}&gt;{children}&lt;/View&gt;<br>    &lt;/View&gt;<br>  )<br>}<br><br>/**<br> * @param {ScreenProps} props - The props for the `ScreenWithScrolling` component.<br> * @returns {JSX.Element} - The rendered `ScreenWithScrolling` component.<br> */<br>function ScreenWithScrolling(props: ScreenProps) {<br>  const {<br>    children,<br>    keyboardShouldPersistTaps = &quot;handled&quot;,<br>    contentContainerStyle,<br>    ScrollViewProps,<br>    style,<br>  } = props as ScrollScreenProps<br><br>  const ref = useRef&lt;ScrollView&gt;(null)<br><br>  const { scrollEnabled, onContentSizeChange, onLayout } = useAutoPreset(props as AutoScreenProps)<br><br>  // Add native behavior of pressing the active tab to scroll to the top of the content<br>  // More info at: https://reactnavigation.org/docs/use-scroll-to-top/<br>  useScrollToTop(ref)<br><br>  return (<br>    &lt;ScrollView<br>      {...{ keyboardShouldPersistTaps, scrollEnabled, ref }}<br>      {...ScrollViewProps}<br>      onLayout={(e) =&gt; {<br>        onLayout(e)<br>        ScrollViewProps?.onLayout?.(e)<br>      }}<br>      onContentSizeChange={(w: number, h: number) =&gt; {<br>        onContentSizeChange(w, h)<br>        ScrollViewProps?.onContentSizeChange?.(w, h)<br>      }}<br>      style={[$outerStyle, ScrollViewProps?.style, style]}<br>      contentContainerStyle={[<br>        $innerStyle,<br>        ScrollViewProps?.contentContainerStyle,<br>        contentContainerStyle,<br>      ]}<br>    &gt;<br>      {children}<br>    &lt;/ScrollView&gt;<br>  )<br>}<br><br>/**<br> * Represents a screen component that provides a consistent layout and behavior for different screen presets.<br> * The `Screen` component can be used with different presets such as &quot;fixed&quot;, &quot;scroll&quot;, or &quot;auto&quot;.<br> * It handles safe area insets, status bar settings, keyboard avoiding behavior, and scrollability based on the preset.<br> * @see [Documentation and Examples]{@link https://docs.infinite.red/ignite-cli/boilerplate/app/components/Screen/}<br> * @param {ScreenProps} props - The props for the `Screen` component.<br> * @returns {JSX.Element} The rendered `Screen` component.<br> */<br>export function Screen(props: ScreenProps) {<br>  const {<br>    theme: { colors },<br>    themeContext,<br>  } = useAppTheme()<br>  const {<br>    backgroundColor,<br>    KeyboardAvoidingViewProps,<br>    keyboardOffset = 0,<br>    safeAreaEdges,<br>    StatusBarProps,<br>    statusBarStyle,<br>  } = props<br><br>  const $containerInsets = useSafeAreaInsetsStyle(safeAreaEdges)<br><br>  return (<br>    &lt;View<br>      style={[<br>        $containerStyle,<br>        { backgroundColor: backgroundColor || colors.background },<br>        $containerInsets,<br>      ]}<br>    &gt;<br>      &lt;StatusBar<br>        style={statusBarStyle || (themeContext === &quot;dark&quot; ? &quot;light&quot; : &quot;dark&quot;)}<br>        {...StatusBarProps}<br>      /&gt;<br><br>      &lt;KeyboardAvoidingView<br>        behavior={isIos ? &quot;padding&quot; : &quot;height&quot;}<br>        keyboardVerticalOffset={keyboardOffset}<br>        {...KeyboardAvoidingViewProps}<br>        style={[$styles.flex1, KeyboardAvoidingViewProps?.style]}<br>      &gt;<br>        {isNonScrolling(props.preset) ? (<br>          &lt;ScreenWithoutScrolling {...props} /&gt;<br>        ) : (<br>          &lt;ScreenWithScrolling {...props} /&gt;<br>        )}<br>      &lt;/KeyboardAvoidingView&gt;<br>    &lt;/View&gt;<br>  )<br>}<br><br>const $containerStyle: ViewStyle = {<br>  flex: 1,<br>  height: &quot;100%&quot;,<br>  width: &quot;100%&quot;,<br>}<br><br>const $outerStyle: ViewStyle = {<br>  flex: 1,<br>  height: &quot;100%&quot;,<br>  width: &quot;100%&quot;,<br>}<br><br>const $innerStyle: ViewStyle = {<br>  justifyContent: &quot;flex-start&quot;,<br>  alignItems: &quot;stretch&quot;,<br>}</pre><h4><strong>Step 6:</strong></h4><p>Running npx expo install --check will check all of the expo packages in their SDK against the version of expo That is installed to ensure compatibility. You can accept these changes or run npx expo install --fix to apply them directly without running the check.</p><h4>Run the app!</h4><p>That’s it! You should be able to run your app in Expo Go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*EyuYb6jqB_67FLBkgFgHbg.png" /></figure><p>If you find this helpful, encourage me so I can write more blogs like this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc95e56b5b75" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>