react-flickity-component
Advanced tools
Comparing version
@@ -130,9 +130,2 @@ "use strict"; | ||
}, 0); | ||
var cellCount = _react["default"].Children.count(this.props.children); | ||
if (cellCount !== this.state.cellCount) this.setState({ | ||
flickityReady: false, | ||
cellCount: cellCount | ||
}); | ||
return element; | ||
@@ -153,2 +146,13 @@ } | ||
} | ||
}], [{ | ||
key: "getDerivedStateFromProps", | ||
value: function getDerivedStateFromProps(props, state) { | ||
var cellCount = _react["default"].Children.count(props.children); | ||
if (cellCount !== state.cellCount) return { | ||
flickityReady: false, | ||
cellCount: cellCount | ||
}; | ||
return null; | ||
} | ||
}]); | ||
@@ -155,0 +159,0 @@ |
{ | ||
"name": "react-flickity-component", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "react flickity component", | ||
@@ -27,3 +27,2 @@ "main": "./lib/index.js", | ||
"fbjs": "^1.0.0", | ||
"flickity": "^2.2.1", | ||
"imagesloaded": "^4.1.4", | ||
@@ -41,2 +40,3 @@ "prop-types": "^15.7.2" | ||
"enzyme-adapter-react-16": "^1.14.0", | ||
"flickity": "^2.2.1", | ||
"jest": "^24.8.0", | ||
@@ -47,4 +47,5 @@ "prettier": "^1.18.2", | ||
"peerDependencies": { | ||
"react": "^16.0.0", | ||
"react-dom": "^16.0.0" | ||
"flickity": "^2.2.1", | ||
"react": "^16.3.0", | ||
"react-dom": "^16.3.0" | ||
}, | ||
@@ -51,0 +52,0 @@ "jest": { |
@@ -15,2 +15,3 @@ import React, { Component } from "react"; | ||
public on(eventName: string, listener: Function): void; | ||
public off(eventName: string, listener: Function): void; | ||
public select(index: number, isWrapped?: boolean, isInstant?: boolean): void; | ||
@@ -17,0 +18,0 @@ public previous(isWrapped?: boolean, isInstant?: boolean): void; |
@@ -21,2 +21,9 @@ import React, { Component } from 'react'; | ||
static getDerivedStateFromProps(props, state) { | ||
const cellCount = React.Children.count(props.children); | ||
if (cellCount !== state.cellCount) | ||
return { flickityReady: false, cellCount }; | ||
return null; | ||
} | ||
componentDidUpdate(prevProps, prevState) { | ||
@@ -70,5 +77,2 @@ const { | ||
setTimeout(() => this.setReady(), 0); | ||
const cellCount = React.Children.count(this.props.children); | ||
if (cellCount !== this.state.cellCount) | ||
this.setState({ flickityReady: false, cellCount }); | ||
return element; | ||
@@ -75,0 +79,0 @@ } |
Sorry, the diff of this file is not supported yet
34256
0.92%541
1.69%12
9.09%- Removed