wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.04k stars 2.67k forks source link

Keyboarding stays open after closing the Side Menu which contains a TextInput #6933

Open MakhouT opened 3 years ago

MakhouT commented 3 years ago

When having a TextInput in a Side Menu and you close the Side Menu, the Keyboard closes during navigation but then instantly opens again after the navigation has been finished.

I am able to reproduce this in the playground app, please check the screen recording: Screen Recording 2021-01-26 at 16 23 29

I tried going around this:

In the SideMenuLeftScreen in the playground app, there is this useEffect:

  useEffect(() => {
    const unsubscribe = Navigation.events().registerComponentListener(
      {
        componentDidAppear: () => {
          Alert.alert('RNN', `componentDidAppear`);
        },
        componentDidDisappear: () => {
          Keyboard.dismiss();
          Alert.alert('RNN', `componentDidDisappear`);
        },
      },
      componentId
    );
    return () => {
      unsubscribe.remove();
    };
  }, [componentId]);

I think we need an extra listener, componentWillDisappear, where we can dismiss the Keyboard first and then let the navigation do its work. Or alternatively, automatically always close the keyboard when doing a navigation operation.

This issue has been tested on the latest version of react native and react-native-navigation. This issue is only happening on iOS. On Android it's behaving correctly out of the box/

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

DonovanDeSmedt commented 3 years ago

Any feedback on this ticket?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.