From 572d39b836443cf39baa1f249ad5ac1b52d0fd9f Mon Sep 17 00:00:00 2001 From: Matas Pocevicius Date: Thu, 21 Jul 2022 09:49:20 +0200 Subject: [PATCH] replaced deprecated method for removing .addEventListener subscription (#75) * replaced deprecated method for removing .addEventListener subscription * package version bup to 2.0.8 --- Swiper.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Swiper.js b/Swiper.js index 3bc90ff5..53f7c76c 100644 --- a/Swiper.js +++ b/Swiper.js @@ -84,7 +84,7 @@ class Swiper extends Component { this._mounted = false this.state.pan.x.removeAllListeners() this.state.pan.y.removeAllListeners() - Dimensions.removeEventListener('change', this.onDimensionsChange) + this.dimensionsChangeSubscription.remove() } getCardStyle = () => { @@ -110,7 +110,7 @@ class Swiper extends Component { initializeCardStyle = () => { // this.forceUpdate() - Dimensions.addEventListener('change', this.onDimensionsChange) + this.dimensionsChangeSubscription = Dimensions.addEventListener('change', this.onDimensionsChange) } initializePanResponder = () => { diff --git a/package.json b/package.json index 6ea569e8..2bf0fb35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-deck-swiper", - "version": "2.0.7", + "version": "2.0.8", "description": "Awesome tinder like card swiper for react-native. Highly Customizable!", "main": "index.js", "scripts": {