question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Tab bar is unhidden too quickly after keyboard dismiss

See original GitHub issue

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

When the keyboard is dismissed the tab bar temporarily flashes on the screen as it is unhidden before the webview has expanded back to the full size of the viewport.

https://user-images.githubusercontent.com/76167627/191752633-e4068d12-a205-421b-9005-ba5194948679.mp4

Expected Behavior

The tab bar should not be unhidden until the web view has expanded back to its full size so that the tab bar does not flash in the center of the screen.

Steps to Reproduce

Use the default capacitor keyboard config:

// capacitor-config.ts
Keyboard: {
    resize: KeyboardResize.Native,
    resizeOnFullScreen: true,
},

This happens on any page with an IonTabBar.

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI : 6.20.1 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/react 6.2.8

Capacitor:

Capacitor CLI : 4.3.0 @capacitor/android : not installed @capacitor/core : 4.3.0 @capacitor/ios : 4.3.0

Utility:

cordova-res : not installed globally native-run : 1.7.0

System:

NodeJS : v16.14.2 (/usr/local/bin/node) npm : 8.7.0 OS : macOS Monterey

Additional Information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
maccmancommented, Oct 10, 2022

We just ran into this too (cc @mlynch )

1reaction
milanhariacommented, Dec 8, 2022

@aginvlad thanks for sharing. I seem to see the tab bar flash still because the tab bar is being unhidden a little too soon so I have changed the timeout delay to 100ms and seems to work consistently. The full code for anybody interested:

const App: React.FC = () => {
  const [keyboardIsOpen, setKeyboardIsOpen] = useState(false);

  useEffect(() => {
    Keyboard.addListener("keyboardWillShow", () => {
      setKeyboardIsOpen(true);
    });
    Keyboard.addListener("keyboardWillHide", () => {
      setTimeout(() => setKeyboardIsOpen(false), 100);
    });

    return () => {
      Keyboard.removeAllListeners();
    };
  }, []);

  return (
    <IonApp>
      <IonReactRouter>
        <IonTabs>
          <IonRouterOutlet>
            <Route exact path="/tab1">
              <Tab1 />
            </Route>
            <Route exact path="/tab2">
              <Tab2 />
            </Route>
            <Route path="/tab3">
              <Tab3 />
            </Route>
            <Route exact path="/">
              <Redirect to="/tab1" />
            </Route>
          </IonRouterOutlet>
          <IonTabBar hidden={keyboardIsOpen} slot="bottom">
            <IonTabButton tab="tab1" href="/tab1">
              <IonIcon icon={triangle} />
              <IonLabel>Tab 1</IonLabel>
            </IonTabButton>
            <IonTabButton tab="tab2" href="/tab2">
              <IonIcon icon={ellipse} />
              <IonLabel>Tab 2</IonLabel>
            </IonTabButton>
            <IonTabButton tab="tab3" href="/tab3">
              <IonIcon icon={square} />
              <IonLabel>Tab 3</IonLabel>
            </IonTabButton>
          </IonTabBar>
        </IonTabs>
      </IonReactRouter>
    </IonApp>
  );
};

export default App;

@liamdebeasi can you give any insight into when this issue will be resolved in production?

Read more comments on GitHub >

github_iconTop Results From Across the Web

I want to hide bottom tab bar when keyboard appear #7386
i have some problem with bottomtabnavigator, bottomtab dosen't disappear when keyboard is activated how can i hide my bottom tab bar when ...
Read more >
React native bottom tab bar pushing itself up when opening ...
If you are using a TextInput in the search bar you could hide the bottom tab when TextInput is focused (and the keyboard...
Read more >
SwiftUI 4, IOS 16 | Apple Developer Forums
So I was able to hide more button at the TabBar and also in navigationBar edit. But now more button and edit button...
Read more >
How to dismiss keyboard with react-navigation in React Native ...
Determines when the keyboard should stay visible after a tap. ... The never mode should be the desired behaviour in most cases, clicking...
Read more >
Customize window layouts and personalize document tabs
Learn how to customize tabs and windows in Visual Studio to create layouts that work best for your development workflows.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found