Primitives turn into geometry={{primitive:box}} when updating any geometry attribute with react state
See original GitHub issueHi,
I’m working on a small aframe-react app where I need to update different geometry attributes via react state (like this: geometry={{ width: this.state.width }}
).
When I’m using the geometry.primitive property everything works as expected, but when I’m using Primitives or the aframe-react-components module, all aframe-primitives are getting updated to geometry={{ primitive: 'box' }}
when I update the react state.
This works as expected:
<Entity
geometry={{ primitive: 'plane', width: this.state.width, height: '2' }}
material={{color: 'blue' }}
position='-4 -1.5 -8'
onClick={this.changeWidth.bind(this)} />
This works onload, but when I update this.state.width
the geometry.primitive of the <a-plane />
-Element changes to ‘box’
<Entity
primitive='a-plane'
geometry={{ width: this.state.width, height: '2' }}
material={{color: 'blue' }}
position='-4 2.5 -8'
onClick={this.changeWidth.bind(this)} />
I used the aframe-react-boilerplate to build a basic demo of the bug. The upper row uses aframe Primitives, the lower row uses the geometry.primitive property. Live Demo with v0.4.0 (Code)
onload | after this.setState({}) |
---|---|
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (4 by maintainers)
Top GitHub Comments
Removed the
props
, and the test I had passes now.@robinnorth ah, the string
[object Object]
makes way more sense than the color property!