版权声明:本文为博主原创文章,转载请附原博客地址。侵权必究 https://blog.csdn.net/wapchief/article/details/79957930
在初始化过后可能会出现此问题,解决方案参考一位 GitHub 的 Issues
需要修改ScrollableTabBar源码:
将this.updateView({value: this.props.scrollValue._value, });
替换为:
this.updateView({value: this.props.scrollValue.__getValue(), });
measureTab(page, event) {
const { x, width, height, } = event.nativeEvent.layout;
this._tabsMeasurements[page] = {left: x, right: x + width, width, height, };
- this.updateView({value: this.props.scrollValue._value, });
+ this.updateView({value: this.props.scrollValue.__getValue(), });
},
render() {
@@ -209,12 +209,12 @@ const ScrollableTabBar = React.createClass({
width = WINDOW_WIDTH;
}
this.setState({ _containerWidth: width, });
- this.updateView({value: this.props.scrollValue._value, });
+ this.updateView({value: this.props.scrollValue.__getValue(), });
},
onContainerLayout(e) {
this._containerMeasurements = e.nativeEvent.layout;
- this.updateView({value: this.props.scrollValue._value, });
+ this.updateView({value: this.props.scrollValue.__getValue(), });
},
});