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

Multiple PopUp #10

Closed
mirus-ua opened this issue Jun 19, 2018 · 1 comment
Closed

Multiple PopUp #10

mirus-ua opened this issue Jun 19, 2018 · 1 comment

Comments

@mirus-ua
Copy link

Hi there. I'm need a help. All my PopUp's open at the same time. This is my component. How can I fix this problem?

`import React, { Component, Fragment } from 'react';
import {
PopupboxManager,
PopupboxContainer
} from 'react-popupbox';
import { render } from 'react-dom';
import Cover from './Cover'
import Slider from './Slider'

export class PhotoPopUp extends Component {
constructor(props) {
super(props)

    this.openPopupbox = this.openPopupbox.bind(this)
}
openPopupbox() {
    const content = (
        <Slider gallery={this.props.gallery}/>
    )
    PopupboxManager.open({ 
        content,
        config: {
            style: {
                height: '90vh'
            },
            className: 'mainPopUpClass'
        }
     })
   

}

render() {
    return (
        <Fragment>
            <div onClick={this.openPopupbox}><Cover cover={this.props.gallery}/></div>
            <PopupboxContainer style={{height: '100%'}}/>
        </Fragment>
    )
}

}`

@fraina
Copy link
Owner

fraina commented Jun 20, 2018

Hi @Miruzz, there should be only one instance of PopupboxContainer in your app. If there are multiple PopupboxContainer, all of them will be opened when you fire PopupboxManager.open().

Just change the content parameter of PopupboxManager.open() when you need different content to show.

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