Skip to content

Commit 4432356

Browse files
committed
New release 1.0.4. Fixed issue when resizing the window after component unmount (Closes #5).
1 parent 0ed34d0 commit 4432356

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

dist/react-swipeable-bottom-sheet.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3854,10 +3854,12 @@ var _propTypes2 = _interopRequireDefault(_propTypes);
38543854
var HeightUpdater = (function (_Component) {
38553855
_inherits(HeightUpdater, _Component);
38563856

3857-
function HeightUpdater() {
3857+
function HeightUpdater(props) {
38583858
_classCallCheck(this, HeightUpdater);
38593859

3860-
_get(Object.getPrototypeOf(HeightUpdater.prototype), 'constructor', this).apply(this, arguments);
3860+
_get(Object.getPrototypeOf(HeightUpdater.prototype), 'constructor', this).call(this, props);
3861+
3862+
this.onWindowResize = this.onWindowResize.bind(this);
38613863
}
38623864

38633865
_createClass(HeightUpdater, [{
@@ -3871,13 +3873,13 @@ var HeightUpdater = (function (_Component) {
38713873
}, {
38723874
key: 'componentWillMount',
38733875
value: function componentWillMount() {
3874-
window.addEventListener('resize', this.onWindowResize.bind(this));
3876+
window.addEventListener('resize', this.onWindowResize);
38753877
this.onWindowResize();
38763878
}
38773879
}, {
38783880
key: 'componentWillUnmount',
38793881
value: function componentWillUnmount() {
3880-
window.removeEventListener('resize', this.onWindowResize.bind(this));
3882+
window.removeEventListener('resize', this.onWindowResize);
38813883
}
38823884
}, {
38833885
key: 'render',

dist/react-swipeable-bottom-sheet.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/HeightUpdater.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ var _propTypes2 = _interopRequireDefault(_propTypes);
2525
var HeightUpdater = (function (_Component) {
2626
_inherits(HeightUpdater, _Component);
2727

28-
function HeightUpdater() {
28+
function HeightUpdater(props) {
2929
_classCallCheck(this, HeightUpdater);
3030

31-
_get(Object.getPrototypeOf(HeightUpdater.prototype), 'constructor', this).apply(this, arguments);
31+
_get(Object.getPrototypeOf(HeightUpdater.prototype), 'constructor', this).call(this, props);
32+
33+
this.onWindowResize = this.onWindowResize.bind(this);
3234
}
3335

3436
_createClass(HeightUpdater, [{
@@ -42,13 +44,13 @@ var HeightUpdater = (function (_Component) {
4244
}, {
4345
key: 'componentWillMount',
4446
value: function componentWillMount() {
45-
window.addEventListener('resize', this.onWindowResize.bind(this));
47+
window.addEventListener('resize', this.onWindowResize);
4648
this.onWindowResize();
4749
}
4850
}, {
4951
key: 'componentWillUnmount',
5052
value: function componentWillUnmount() {
51-
window.removeEventListener('resize', this.onWindowResize.bind(this));
53+
window.removeEventListener('resize', this.onWindowResize);
5254
}
5355
}, {
5456
key: 'render',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-swipeable-bottom-sheet",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "Swipeable Bottom Sheet",
55
"main": "lib/SwipeableBottomSheet.js",
66
"author": "Emmanuel Fonteneau",

src/HeightUpdater.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import PropTypes from 'prop-types';
33

44

55
class HeightUpdater extends Component {
6+
constructor(props){
7+
super(props);
8+
9+
this.onWindowResize = this.onWindowResize.bind(this);
10+
}
11+
612
onWindowResize(){
713
const height = window.innerHeight;
814
if(height !== this.props.height){
@@ -11,12 +17,12 @@ class HeightUpdater extends Component {
1117
}
1218

1319
componentWillMount(){
14-
window.addEventListener('resize', this.onWindowResize.bind(this));
20+
window.addEventListener('resize', this.onWindowResize);
1521
this.onWindowResize();
1622
}
1723

1824
componentWillUnmount(){
19-
window.removeEventListener('resize', this.onWindowResize.bind(this));
25+
window.removeEventListener('resize', this.onWindowResize);
2026
}
2127

2228
render(){

0 commit comments

Comments
 (0)