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.

Multiple Popovers opening in sequence, second not opening when triggered by button in first

See original GitHub issue

Sorry for my bad English. I want to use react-native-popover-view as a guide for new user. If user read the first guide and they click “Ok” it will open the second guide. My code is below. Thank you for your help ! “react-native-popover-view”: “version”: “1.0.9”, “react-native”: “version”: “0.57.4”,

export default class App extends Component<Props> {
  componentDidMount() {
    this.setState({ isVisible: true });
  }
  state = {
    isVisible: false,
    isVisible2: false
  };

  showPopover() {
    this.setState({ isVisible: true });
  }
  showPopover2() {
    this.setState({ isVisible2: true });
    this.setState({ isVisible: false });
  }

  closePopover() {
    this.setState({ isVisible: false });
  }
  render() {
    return (
      <View style={styles.container}>
        <Popover
          isVisible={this.state.isVisible}
          fromView={this.touchable}
          onClose={() => this.closePopover()}
        >
          <Text style={styles.test}>The first guide</Text>
          <TouchableHighlight
            style={styles.button}
            onPress={() => this.showPopover2()}
          >
            <Text>go to second</Text>
          </TouchableHighlight>
        </Popover>
        <Popover
          isVisible={this.state.isVisible2}
          fromView={this.touchable2}
          onClose={() => this.closePopover()}
        >
          <Text style={styles.test}>The second guide</Text>
          <TouchableHighlight
            style={styles.button}
            onPress={() => this.showPopover()}
          >
            <Text>Press me</Text>
          </TouchableHighlight>
        </Popover>

        <TouchableHighlight
          ref={ref => (this.touchable = ref)}
          style={styles.button}
          onPress={() => this.showPopover()}
        >
          <Text>Press me</Text>
        </TouchableHighlight>
        <Text
          ref2={ref2 => (this.touchable2 = ref2)}
          tyle={styles.instructions}
        >
          text 1
        </Text>
      </View>
    );
  }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
SteffeyDevcommented, Oct 30, 2018

I’m considering making a change to the popover code to make this easier, which would detect when there is a modal open and then delay the second popover from trying to show until the first is closed… so you are welcome to wait for that update, but no guarantee on timing.

0reactions
huynguyen2903commented, Oct 30, 2018

It’s work. Thank you very much @SteffeyDev.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Popovers not showing up on first click but ...
The problem is when I click on the tips-icon.png button, the popover doesn't show up on first click (I guess it's because I...
Read more >
Popovers
When triggered from anchors that wrap across multiple lines, popovers will be centered between the anchors' overall width. Use white-space: nowrap; ...
Read more >
ion-popover
ion-popover is a dialog that appears on top of the current page. Learn about the popover UI component and CSS custom properties for...
Read more >
Bootstrap popovers
Use the focus trigger to dismiss popovers on the user's next click of a different element than the toggle element. Specific markup required...
Read more >
Popover API (Explainer)
Popovers (of a particular type) are generally "one at a time" - opening one popover closes others. This document proposes a set of...
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