Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltip disappearing after first tap #43

Open
FranDepascuali opened this issue Aug 16, 2018 · 2 comments
Open

Tooltip disappearing after first tap #43

FranDepascuali opened this issue Aug 16, 2018 · 2 comments

Comments

@FranDepascuali
Copy link

FranDepascuali commented Aug 16, 2018

Hey there! First of all, thanks for this cool library. It has been working great.

We are having an issue when displaying the tooltip the first time after the user opens the app.
output

The tooltip dissapears that first time. After that, it works correctly:

output

The code is simple:

export default class ContextMenu extends React.PureComponent {
  componentWillUnmount() {
    if (this.ref) {
      this.ref.hideMenu();
      delete this.ref;
    }
  }

  setRef = (ref) => {
    if (!ref) {
      return;
    }

    this.ref = ref;
    if (ref) {
      setTimeout(() => {
        if (this.ref) {
          this.ref.showMenu();
        }
      }, 100);
    }
  }

  render() {
    const actions = getActions(this.props);

    return (
      <ToolTip
        actions={actions}
        ref={this.setRef}
      >
        <View />
      </ToolTip>
    );
  }
}

Note that we had to introduce that delay because the tooltip doesn't appear when placed in componentDidMount.
I tried to debug this, as I thought that a hideMenu() was being called, but it wasn't. showMenu() is called correctly and then the context menu disappears without a call to hideMenu().

Any help would be appreciated, thanks!

@andrewdazs
Copy link

@FranDepascuali did you find a way to solve this? it's happening with me too :/

@FranDepascuali
Copy link
Author

@andrewdazs no longer working with RN, sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants