From 7e5010d3b8547846d533548e5ed72604c7b15b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=89=E5=BC=98?= Date: Wed, 29 Aug 2018 17:14:24 +0800 Subject: [PATCH 1/2] fix(SwipeableTabBarNode): totalDelta is missing in didUpdate setCache --- src/SwipeableTabBarNode.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SwipeableTabBarNode.js b/src/SwipeableTabBarNode.js index f3134c6a..5620551f 100755 --- a/src/SwipeableTabBarNode.js +++ b/src/SwipeableTabBarNode.js @@ -71,6 +71,7 @@ export default class SwipeableTabBarNode extends React.Component { const _viewSize = getStyle(this.realNode, _isVertical ? 'height' : 'width'); const _tabWidth = _viewSize / pageSize; this.cache = { + ...this.cache, vertical: _isVertical, totalAvaliableDelta: _tabWidth * panels.length - _viewSize, tabWidth: _tabWidth, From 148c4cf8fcb0e655661b67611f12ecb85333358c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=89=E5=BC=98?= Date: Wed, 29 Aug 2018 17:52:26 +0800 Subject: [PATCH 2/2] fix(SwipeableTabBarNode): need more condition to call setSwipePositionByKey in cDU --- src/SwipeableTabBarNode.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SwipeableTabBarNode.js b/src/SwipeableTabBarNode.js index 5620551f..537c2ab8 100755 --- a/src/SwipeableTabBarNode.js +++ b/src/SwipeableTabBarNode.js @@ -32,7 +32,10 @@ export default class SwipeableTabBarNode extends React.Component { componentDidUpdate(prevProps) { this.setCache(); - if (this.props.activeKey && this.props.activeKey !== prevProps.activeKey) { + if ((this.props.activeKey && this.props.activeKey !== prevProps.activeKey) + || this.props.panels.length !== prevProps.panels.length + || this.props.pageSize !== prevProps.pageSize + ) { this.setSwipePositionByKey(this.props.activeKey); } }