outside-click-handler
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "outside-click-handler", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Outside click handler for React", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,2 +6,11 @@ | ||
This component is designed to handle all clicks outside, for example, to open and close modal windows. | ||
## Features | ||
- Easy to use | ||
- Tests covered | ||
- Flowtype definitions | ||
- Lightweight (2.8kb gzip) | ||
## API | ||
@@ -12,3 +21,3 @@ | ||
``` | ||
````js | ||
type Props = { | ||
@@ -18,5 +27,31 @@ children: React.Node, | ||
}; | ||
``` | ||
```` | ||
## How to use | ||
````js | ||
class Wrapper extends React.Component { | ||
onClick = () => this.setState({ isShownHidden: !this.state.isShownHidden }); | ||
render() { | ||
const { isShownHidden } = this.state; | ||
return ( | ||
<OutsideClickHandler onOutsideClick={this.onClick}> | ||
<span>Im your child!</span> | ||
{isShownHidden && <span>Im your hidden child!</span>} | ||
</OutsideClickHandler> | ||
); | ||
} | ||
} | ||
```` | ||
## Performance | ||
If you want to use a component in lists, use conditions or methods to avoid poor performance. | ||
## Support | ||
If you have any questions, please email me at botev.st@gmail.com or open the issue. | ||
To use static typing, make sure [that you have installed Flow](https://flow.org/en/docs/install). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
133537
55
0