From 8222cf4d93d8542209d755b8e447a67d8b7fd1e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuzcan=20K=C3=BC=C3=A7=C3=BCkbayrak?= Date: Sun, 7 Oct 2018 17:55:34 +0300 Subject: [PATCH 1/4] Add enablePointerEvents prop to Collapsible (#250) --- Collapsible.js | 9 +++++++-- README.md | 1 + index.d.ts | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Collapsible.js b/Collapsible.js index 06e8a3a..9a6e35a 100644 --- a/Collapsible.js +++ b/Collapsible.js @@ -10,6 +10,7 @@ export default class Collapsible extends Component { align: PropTypes.oneOf(['top', 'center', 'bottom']), collapsed: PropTypes.bool, collapsedHeight: PropTypes.number, + enablePointerEvents: PropTypes.bool, duration: PropTypes.number, easing: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), style: ViewPropTypes.style, @@ -21,6 +22,7 @@ export default class Collapsible extends Component { align: 'top', collapsed: true, collapsedHeight: 0, + enablePointerEvents: false, duration: 300, easing: 'easeOutCubic', onAnimationEnd: () => null, @@ -165,7 +167,7 @@ export default class Collapsible extends Component { }; render() { - const { collapsed } = this.props; + const { collapsed, enablePointerEvents } = this.props; const { height, contentHeight, measuring, measured } = this.state; const hasKnownHeight = !measuring && (measured || collapsed); const style = hasKnownHeight && { @@ -196,7 +198,10 @@ export default class Collapsible extends Component { ]; } return ( - + Date: Sun, 7 Oct 2018 15:56:26 +0100 Subject: [PATCH 2/4] Handle collapsible unmount during animation (#216) * Handle collapsible unmount during animation As discussed initially in https://github.com/oblador/react-native-collapsible/commit/3a600ca6fe18a84c9dcdd358fe9b944d5b30f026#commitcomment-29318224 * Update Collapsible.js * lint --- Collapsible.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Collapsible.js b/Collapsible.js index 9a6e35a..92ff103 100644 --- a/Collapsible.js +++ b/Collapsible.js @@ -49,6 +49,10 @@ export default class Collapsible extends Component { } } + componentWillUnmount() { + this.unmounted = true; + } + _componentDidUpdate(prevProps) { if (prevProps.collapsed !== this.props.collapsed) { this._toggleCollapsed(this.props.collapsed); @@ -146,9 +150,17 @@ export default class Collapsible extends Component { toValue: height, duration, easing, - }).start(() => - this.setState({ animating: false }, this.props.onAnimationEnd) - ); + }).start(() => { + if (this.unmounted) { + return; + } + this.setState({ animating: false }, () => { + if (this.unmounted) { + return; + } + this.props.onAnimationEnd(); + }); + }); } _handleLayoutChange = event => { From 40d9c461e69fd3281cbf33ec72eb57df3be64911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lorber?= Date: Sun, 7 Oct 2018 16:16:12 +0100 Subject: [PATCH 3/4] Ensure node version is compatible with eslint + nvmrc (#224) --- .nvmrc | 1 + package.json | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..dba04c1 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +8.11.3 diff --git a/package.json b/package.json index 4a80401..2b32379 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,9 @@ "scripts": { "test": "eslint *.js" }, + "engines": { + "node": "^6.14.0 || ^8.10.0 || >=9.10.0" + }, "keywords": [ "react-native", "react-component", From 482e0c0a1d3068b79fd87a74cb1c3afc7c55670e Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Sun, 7 Oct 2018 11:17:20 -0400 Subject: [PATCH 4/4] chore: Bump version [ci-skip] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2b32379..7b3b07e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-collapsible", - "version": "1.1.0", + "version": "1.2.0", "description": "Animated collapsible component for React Native using the Animated API. Good for accordions, toggles etc", "main": "Collapsible.js", "types": "index.d.ts",