Fix PropType warnings

This commit is contained in:
uwap 2018-07-10 18:51:05 +02:00
parent 0fe8911d79
commit 24496bbf3f
2 changed files with 28 additions and 19 deletions

View file

@ -28,56 +28,65 @@ export default class UiItemList extends React.PureComponent<UiItemListProps> {
);
}
if (control.type === "section") {
return this.renderControl(control);
return this.renderControl(control, key.toString());
}
return (
<ListItem key={key}>
{control.icon == null || control.type === "link" ||
<ListItemIcon>
{renderIcon(control.icon(this.props.state), "mdi-24px")}
</ListItemIcon>}
{this.renderControl(control)}
<React.Fragment>
{control.icon == null || control.type === "link" ||
<ListItemIcon key={`${key.toString()}-liicon`}>
{renderIcon(control.icon(this.props.state), "mdi-24px")}
</ListItemIcon>}
{this.renderControl(control, key.toString())}
</React.Fragment>
</ListItem>
);
});
}
renderControl(control: ControlUI) {
renderControl(control: ControlUI, key: string) {
switch (control.type) {
case "toggle": {
return <Toggle item={control}
state={this.props.state}
onChangeState={this.props.onChangeState} />;
onChangeState={this.props.onChangeState}
key={`${key}-licontrol`} />;
}
case "dropDown": {
return <DropDown item={control}
state={this.props.state}
onChangeState={this.props.onChangeState} />;
onChangeState={this.props.onChangeState}
key={`${key}-licontrol`} />;
}
case "section": {
return <Section item={control}
state={this.props.state}
onChangeState={this.props.onChangeState} />;
onChangeState={this.props.onChangeState}
key={`${key}-licontrol`} />;
}
case "link": {
return <Link item={control}
state={this.props.state}
onChangeState={this.props.onChangeState} />;
onChangeState={this.props.onChangeState}
key={`${key}-licontrol`} />;
}
case "slider": {
return <Slider item={control}
state={this.props.state}
onChangeState={this.props.onChangeState} />;
onChangeState={this.props.onChangeState}
key={`${key}-licontrol`} />;
}
case "text": {
return <Text item={control}
state={this.props.state}
onChangeState={this.props.onChangeState} />;
onChangeState={this.props.onChangeState}
key={`${key}-licontrol`} />;
}
case "progress": {
return <Progress item={control}
state={this.props.state}
onChangeState={this.props.onChangeState} />;
onChangeState={this.props.onChangeState}
key={`${key}-licontrol`} />;
}
default: {
throw new Error(