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

Using custom component as trigger does not work #84

Closed
kevinlaw91 opened this issue May 10, 2019 · 1 comment
Closed

Using custom component as trigger does not work #84

kevinlaw91 opened this issue May 10, 2019 · 1 comment

Comments

@kevinlaw91
Copy link

Using custom components such as <FancyButton /> as trigger does not work

function CustomButton () {
  return <button>Custom</button>;
}

<Popup trigger={<CustomButton />}>
  <div>Not Work</div>
</Popup>

Version

1.3.2

Test Case

https://codesandbox.io/s/9jx6mx22w

Expected Behavior

Popup will show but it doesn't

@yjose
Copy link
Owner

yjose commented May 11, 2019

Hi @kevinlaw91
You just need to pass missed props to your trigger like the following :

function CustomButton (props) {
  return <button {...props}>Custom</button>;
}

<Popup trigger={(props) => <CustomButton {...props}  />}>
  <div>Not Work</div>
</Popup>

https://codesandbox.io/s/2lv3wo9ly

@yjose yjose closed this as completed May 11, 2019
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