react-weui
react-weui copied to clipboard
TabBarItem is not update after receive new defaultIndex
trafficstars
Do you want to request a feature or report a bug (建议还是bug) ? bug
What is the current behavior? (现有状况) https://github.com/weui/react-weui/blob/master/src/components/tab/tab.js#L38 Can't change defaultIndex after first render.
What is the expected behavior? (应有状况)
Update this.state.index after receive new props.
componentWillReceiveProps(nextProps) {
if (this.props.defaultIndex != nextProps.defaultIndex) {
this.setState({index: nextProps.defaultIndex})
}
}
Which versions of React-weui, weui, and which OS and device are affected by this issue? (React-weui版本 weui版本 机型和系统) [email protected], [email protected], all.
有遇到这个问题 可以发个pr吗
@n7best pr发到这里还是你的fork?
这里就好了
Searchbar组件也有这个问题,是团队遗漏了还是有什么特殊的考虑呢?