如何解决以下错误:警告:遇到两个具有相同密钥 this.player = player => {
const pos = interpolate(player.position,player.movementVector)
resetDivSets()
calcViewMatrix()
mat4Translate(viewMatrix,-pos.x * glScale,-3.1 * glScale,pos.y * glScale)
mat4RotateY(viewMatrix,playerRotation(player,player.drawMovementVector))
gl.uniformMatrix4fv(uVmatrix,false,viewMatrix)
gl.uniform3f(uAmbientColor,1,1)
gl.drawElements(gl.TRIANGLES,builtSprites.player.ibCount,gl.UNSIGNED_SHORT,builtSprites.player.ibStart * 2)
// compute a clipspace position
var clipspace = WHAT TO HAVE HERE??;
// divide X and Y by W just like the GPU does.
clipspace[0] /= clipspace[3];
clipspace[1] /= clipspace[3];
// convert from clipspace to pixels
var pixelX = (clipspace[0] * 0.5 + 0.5) * gl.canvas.width;
var pixelY = (clipspace[1] * -0.5 + 0.5) * gl.canvas.height;
addDivSet("Player Name under player object",pixelX,pixelY);
的孩子。密钥应该是唯一的,以便组件在更新过程中保持其身份。非唯一键可能会导致子代重复和/或被忽略-这种行为不受支持,并且可能在将来的版本中更改。
那是我的清单:
[object Object]
那是我的清单项目:
<List style={custom.PartList}>
<flatList extraData={this.state} data={this.state.data} keyExtractor={this._keyExtractor.bind(this)} renderItem={this._renderItem.bind(this)} />
</List>
这就是我的keyExtractor方法:
/* Render Item - Render One Row - Item - (Tool) */
_renderItem({ item }) {
const custom = styles(this.props);
return (
<View style={custom.PartView}>
<ListItem style={custom.PartListItem} onPress={() => this._handleRead(item.tool_id,item.tool_name,item.tool_description,item.tool_count,item.tool_availability)}>
<Image style={custom.PartImage} source={require('@app/assets/images/tools.png')}/>
<Text style={custom.PartName}>{item.tool_name}</Text>
</ListItem>
</View>
);
}
/* /Render Item - Render One Row - Item - (Tool)/ */