react-portal-popover
Advanced tools
Comparing version 0.1.10 to 0.1.11
@@ -30,9 +30,9 @@ import React from 'react'; | ||
<div> | ||
<OverlayTrigger overlay={toolTip} label={'Excerpt'} showLabel={'Show'} hideLabel={'Hide'}> | ||
<OverlayTrigger closeOnScroll={true} overlay={toolTip} label={'Excerpt'} showLabel={'Show'} hideLabel={'Hide'}> | ||
<button>Toggle</button> | ||
</OverlayTrigger> | ||
<div style={right}> | ||
<OverlayTrigger overlay={toolTip} label={'Excerpt'} showLabel={'Show'} hideLabel={'Hide'}> | ||
<button>Toggle 2</button> | ||
</OverlayTrigger> | ||
<OverlayTrigger closeOnScroll={true} overlay={toolTip} label={'Excerpt'} showLabel={'Show'} hideLabel={'Hide'}> | ||
<button>Toggle 2</button> | ||
</OverlayTrigger> | ||
</div> | ||
@@ -39,0 +39,0 @@ </div> |
@@ -41,2 +41,3 @@ 'use strict'; | ||
_this.accessibleLabel = _this.accessibleLabel.bind(_this); | ||
_this.onScroll = _this.onScroll.bind(_this); | ||
return _this; | ||
@@ -51,3 +52,4 @@ } | ||
if (this.props.closeOnScroll) { | ||
document.addEventListener('scroll', this.onClickOutside); | ||
// Use capture for scroll events | ||
window.addEventListener('scroll', this.onScroll, true); | ||
} | ||
@@ -61,3 +63,3 @@ } | ||
if (this.props.closeOnScroll) { | ||
document.removeEventListener('scroll', this.onClickOutside); | ||
window.removeEventListener('scroll', this.onScroll, false); | ||
} | ||
@@ -106,2 +108,9 @@ } | ||
}, { | ||
key: 'onScroll', | ||
value: function onScroll() { | ||
this.setState({ | ||
open: false | ||
}); | ||
} | ||
}, { | ||
key: 'onClickOutside', | ||
@@ -108,0 +117,0 @@ value: function onClickOutside() { |
{ | ||
"name": "react-portal-popover", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"description": "Popover for React using portals", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -1,2 +0,2 @@ | ||
// 'use strict'; | ||
'use strict'; | ||
@@ -3,0 +3,0 @@ const path = require('path'); |
@@ -17,2 +17,3 @@ import React from 'react'; | ||
this.accessibleLabel = this.accessibleLabel.bind(this); | ||
this.onScroll = this.onScroll.bind(this); | ||
} | ||
@@ -24,3 +25,4 @@ | ||
if (this.props.closeOnScroll) { | ||
document.addEventListener('scroll', this.onClickOutside); | ||
// Use capture for scroll events | ||
window.addEventListener('scroll', this.onScroll, true); | ||
} | ||
@@ -33,3 +35,3 @@ } | ||
if (this.props.closeOnScroll) { | ||
document.removeEventListener('scroll', this.onClickOutside); | ||
window.removeEventListener('scroll', this.onScroll, false); | ||
} | ||
@@ -70,2 +72,8 @@ } | ||
onScroll() { | ||
this.setState({ | ||
open: false, | ||
}); | ||
} | ||
onClickOutside() { | ||
@@ -72,0 +80,0 @@ this.removeCloseHandler(); |
Sorry, the diff of this file is not supported yet
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
60037
1390