Skip to content

bug: Tab bar is unhidden too quickly after keyboard dismiss #25990

Closed

Description

@milanharia

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.

Simulator.Screen.Recording.-.iPhone.14.-.2022-09-22.at.13.55.17.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

Activity

  1. added
    package: core
    type: bug
    on Sep 22, 2022
  2. maccman commented on Oct 10, 2022

    @maccman

    We just ran into this too (cc @mlynch )

  3. vojto commented on Oct 10, 2022

    @vojto

    Looks like this started in 6.2.3. Works well in 6.2.2. Could be related to #25746

  4. BinDohry commented on Nov 7, 2022

    @BinDohry

    @liamdebeasi Any info on when this fix will be merged into production? Thanks!

  5. vojto commented on Nov 25, 2022

    @vojto

    Still breaking in 6.3.8.

  6. aginvlad commented on Dec 3, 2022

    @aginvlad

    Same for me in 6.3.9
    I temporarily fixed it with Capacitor Keyboard

    useEffect(() => {
      Keyboard.addListener('keyboardWillShow', () => setKeyboardShown(true));
      Keyboard.addListener('keyboardWillHide', () =>
        setTimeout(() => {
          setKeyboardShown(false);
        }, 10)
      );
    
      return () => {
        Keyboard.removeAllListeners();
      };
    }, []);
    

    And then provided keyboardShown variable to IonTabBar hidden prop

  7. milanharia commented on Dec 8, 2022

    @milanharia
    Author

    @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?

  8. vojto commented on Jan 18, 2023

    @vojto

    Still breaking in 6.3.8.

    No improvement in 6.4.2.

  9. vojto commented on Mar 30, 2023

    @vojto

    Just upgraded to Ionic 7.0.0, and not seeing any improvement.

    Can we get some feedback on this please?

    I guess we'll have to use some hack, we're currently stuck on Ionic 6.2.2.

  10. maccman commented on Apr 6, 2023

    @maccman

    @mlynch this one seems worth looking at :)

  11. mlynch commented on Apr 12, 2023

    @mlynch
    Contributor

    @maccman talked to the team and it's currently being looked at. Hope to have an update soon

  12. informatikTirol commented on May 4, 2023

    @informatikTirol

    I have the same issue with Ionic 7, see #27386

  13. 6 remaining items

  14. liamdebeasi commented on May 9, 2023

    @liamdebeasi
    Contributor

    I'm not able to install the dependencies in your project:

    liamdebeasi@MacBook-Pro APP_RL_GITHUB_ISSUE_25990 % npm i
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE could not resolve
    npm ERR! 
    npm ERR! While resolving: @angular/[email protected]
    npm ERR! Found: @angular/[email protected]
    npm ERR! node_modules/@angular/common
    npm ERR!   @angular/common@"^15.0.0" from the root project
    npm ERR!   peer @angular/common@"15.2.1" from @angular/[email protected]
    npm ERR!   node_modules/@angular/forms
    npm ERR!     @angular/forms@"^15.0.0" from the root project
    npm ERR!     peer @angular/forms@">=14.0.0" from @ionic/[email protected]
    npm ERR!     node_modules/@ionic/angular
    npm ERR!       @ionic/angular@"^7.0.6-dev.11683572927.1bfe3920" from the root project
    npm ERR!     1 more (ngx-chips)
    npm ERR!   6 more (@angular/platform-browser, ...)
    npm ERR! 
    npm ERR! Could not resolve dependency:
    npm ERR! peer @angular/common@"15.2.2" from @angular/[email protected]
    npm ERR! node_modules/@angular/service-worker
    npm ERR!   @angular/service-worker@"^15.2.2" from the root project
    npm ERR!   peerOptional @angular/service-worker@"^15.0.0" from @angular-devkit/[email protected]
    npm ERR!   node_modules/@angular-devkit/build-angular
    npm ERR!     dev @angular-devkit/build-angular@"^15.0.0" from the root project
    npm ERR! 
    npm ERR! Conflicting peer dependency: @angular/[email protected]
    npm ERR! node_modules/@angular/common
    npm ERR!   peer @angular/common@"15.2.2" from @angular/[email protected]
    npm ERR!   node_modules/@angular/service-worker
    npm ERR!     @angular/service-worker@"^15.2.2" from the root project
    npm ERR!     peerOptional @angular/service-worker@"^15.0.0" from @angular-devkit/[email protected]
    npm ERR!     node_modules/@angular-devkit/build-angular
    npm ERR!       dev @angular-devkit/build-angular@"^15.0.0" from the root project
    npm ERR! 
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force, or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR! 
    

    Do you have a minimal reproduction of the issue?

  15. liamdebeasi commented on May 9, 2023

    @liamdebeasi
    Contributor

    The issue appears resolved when using the dev build and your sample reproduction:

    RPReplay_Final1683640311.MP4

    Can you make sure you do a clean build/sync when testing in your application?

    npm run build && npx cap copy ios
    
  16. informatikTirol commented on May 9, 2023

    @informatikTirol

    I did a clean build / sync, the bug is still there..

    I have to toggle more often to reproduce the error, see video..

    RPReplay_Final1683640684.MP4

    The first time it happens on second 7

    DeiZ

    I use an Iphone 14 Pro

  17. liamdebeasi commented on May 9, 2023

    @liamdebeasi
    Contributor

    Can you give this new dev build a try?

    7.0.6-dev.11683643659.1ad8e6be
    
  18. informatikTirol commented on May 10, 2023

    @informatikTirol

    It is better, but not completely gone.
    It seems to me that it happens even more often when using "ion-split-pane" with "tabs", at least the APP "#25990 (comment)" flickers more...

  19. liamdebeasi commented on May 10, 2023

    @liamdebeasi
    Contributor

    Do you have an example of this issue happening when using split pane?

  20. informatikTirol commented on May 11, 2023

    @informatikTirol

    Here is the App with the split pane. I removed a few packages, so
    npm install
    should work on your machine.

    https://www.dropbox.com/s/qbr278uqe8x9p5r/APP_RL_GITHUB_ISSUE_25990_2.zip?dl=0

    Please a short response, then I will delete the File, thanks!

    Here you see the bug:
    zglx

    Most likely the error occurs when going from tab 1 to tab 2, then directly activating the input.

  21. liamdebeasi commented on May 12, 2023

    @liamdebeasi
    Contributor

    Thanks for testing. I think I have resolved the lingering issues if you are interested in giving this another test:

    npm install @ionic/[email protected]
    
  22. informatikTirol commented on May 15, 2023

    @informatikTirol

    Works, thank you!

  23. added a commit that references this issue on May 16, 2023
    70d9854
  24. added a commit that references this issue on May 22, 2023
    8889324
  25. ionitron-bot commented on Jun 15, 2023

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  26. locked and limited conversation to collaborators on Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: coretype: bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions