jd-opensource / jd-opensource/taro-ui

重新渲染导致 Noticebar 重新开始 Animation

Open
#1,368 4 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.7k
Forks
740
PR merge metrics
No merged PRs in 30d

Description

**问题描述**
如果在一个组件中 存在 Noticebar , 那么如果当前组件状态存在修改, 那么 NoticeBar 就会因为这样的修改而被迫重新开始 Animation
![GIF 2021-7-8 17-11-49](https://user-images.githubusercontent.com/22767695/124895971-9e4e6080-e00f-11eb-81d2-80fc2438dcc7.gif)

```tsx
interface State {
current: number;
}
const fakeArr = Array(10).fill(0);
class Index extends Component<{}, State> {
constructor(props) {
super(props);
this.state = {
current: 0,
};
}

handleClick(value) {
this.setState({
current: value,
});
}
render() {
return (



门店新上产品,快去看看哪款合适你~



{fakeArr.map((_, index) => (

))}





);
}
}

export default Index;

```

**期望行为**
不论Tab如何切换, 不应该导致 Noticebar 重新渲染

**系统信息**
微信小程序中
"@tarojs/components": "3.2.13",
"@tarojs/react": "3.2.13",
"@tarojs/runtime": "3.2.13",
"@tarojs/taro": "3.2.13",
"taro-ui": "^3.0.0-alpha.10"

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.