react-hardware
react-hardware copied to clipboard
DevTool hides children
DevTool does not display children of components that doesn't call setState
.
Everything works as expected with the firmata mock. To reproduce this you will need to have the actual hardware.
Tested in React Native DevTools inside Nuclide. RH version: master Hardware: Arduino UNO Firmata: 0.11.3
Expected behavior
<Led>
<pin pin={9} value={1} />
</Led>
Actual behavior
<Led />
Example that hides children
import React, {Component} from 'react';
import {getPort} from '../port';
import ReactHardware from '../../src';
class Led extends Component {
render() {
return (
<pin
pin={9}
value={1}
mode={'OUTPUT'}
/>
);
}
}
ReactHardware.render(
<Led />,
getPort(),
(inst) => {
console.log('Rendered <%s />', Led.name);
}
);
Example that shows children
import React, {Component} from 'react';
import {getPort} from '../port';
import ReactHardware from '../../src';
class Led extends Component {
constructor() {
super();
this.state = {value: 1};
}
componentDidMount() {
this.setState({value: 0});
}
render() {
return (
<pin
pin={9}
value={this.state.value}
mode={'OUTPUT'}
/>
);
}
}
ReactHardware.render(
<Led />,
getPort(),
(inst) => {
console.log('Rendered <%s />', Led.name);
}
);
Nice discovery! This is likely going to be deferred until facebook/react#6549 lands which will likely supersede the entire DevTools integration that is currently implemented.