<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: max</title>
    <description>The latest articles on DEV Community by max (@max_b6de653730725567de515).</description>
    <link>https://dev.to/max_b6de653730725567de515</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3420617%2Ffee6301f-a56c-4add-a4c0-d3d89ba5601d.png</url>
      <title>DEV Community: max</title>
      <link>https://dev.to/max_b6de653730725567de515</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/max_b6de653730725567de515"/>
    <language>en</language>
    <item>
      <title>Keep bottom action buttons visible on iOS using React</title>
      <dc:creator>max</dc:creator>
      <pubDate>Fri, 08 Aug 2025 01:20:37 +0000</pubDate>
      <link>https://dev.to/max_b6de653730725567de515/keep-bottom-action-buttons-visible-on-ios-using-react-18jo</link>
      <guid>https://dev.to/max_b6de653730725567de515/keep-bottom-action-buttons-visible-on-ios-using-react-18jo</guid>
      <description>&lt;p&gt;If you've ever built a mobile-friendly web app, you've probably noticed that iOS Safari and Chrome handle the on-screen keyboard differently than Android. When the keyboard pops up, any element that's fixed to the bottom of the viewport disappears behind it.&lt;/p&gt;

&lt;p&gt;I ran into this while building a form. Users couldn't see the "Submit" button once they focused an input field, because the keyboard covered it. CSS &lt;code&gt;position: fixed&lt;/code&gt; just wasn't enough.&lt;/p&gt;

&lt;p&gt;To solve this, I wrote a small React component that listens to the &lt;code&gt;visualViewport&lt;/code&gt; API to detect the keyboard height and adjust the element's position in real time. It fades out when the user scrolls so it doesn’t get in the way, and falls back to normal behaviour on non-iOS devices.&lt;/p&gt;

&lt;p&gt;The component is open source; feel free to use it or contribute. You can install it from npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install react-bottom-fixed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then wrap your button:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;BottomFixed&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-bottom-fixed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;MyForm&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* your page content here */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;BottomFixed&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Done!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Submit&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;BottomFixed&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On iOS, the button will stay just above the keyboard; on other platforms it will act as a regular container.&lt;/p&gt;

&lt;p&gt;I'm sharing this in case anyone else has been frustrated by this issue. The source code and live demo are available on GitHub: &lt;a href="https://github.com/almond-bongbong/react-bottom-fixed" rel="noopener noreferrer"&gt;https://github.com/almond-bongbong/react-bottom-fixed&lt;/a&gt;. Feedback and contributions are welcome!&lt;/p&gt;

</description>
      <category>react</category>
      <category>ios</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
