我有一个 div 使用:
-webkit-clip-path: polygon(0 0, 100% 7%, 100% 100%, 0 100%);
clip-path: polygon(0 0, 100% 7%, 100% 100%, 0 100%);
Run Code Online (Sandbox Code Playgroud)
在另一个 div 中的这个 div 中有一个图像。这个特定代码导致 chrome 性能下降是否有原因 - 滚动也变得不稳定。在 Firefox 中,一切看起来都很正常。
奇怪的是,它只会在视图位于该元素上时影响滚动,一旦你滚动过去它看起来又好了
很抱歉标题的绕口令,但这是一个非常具体的问题。
目前我有一系列被道具穿过的对象。我正在尝试将所有“分数”值汇总在一起并将其显示在我的应用程序中。
该对象如下所示:
[{'id': '1', 'score': '10'}, {'id': '2', 'score': '20'}, {'id': '3', 'score': '35'}]
Run Code Online (Sandbox Code Playgroud)
在应用程序内部,它被调用如下:
state = {
content: this.props.navigation.getParam('content', false),
}
Run Code Online (Sandbox Code Playgroud)
scoreCount = () => {
const content = this.state.content;
if (content) {
return content.reduce((prev, current) => prev.score + current.score);
} else {
return false;
}
Run Code Online (Sandbox Code Playgroud)
render() {
const score = this.scoreCount()
return (
<View>
<Text>Score:</Text>
{ score ?
<Text>
{ score }
</Text> :
<Text>
0
</Text>
}
</View>
)}
Run Code Online (Sandbox Code Playgroud)
返回时显示“undefined35”
我知道这与在通话时无法使用道具有关,但我不确定如何将分数正确返回给视图
任何帮助将不胜感激