BugReporterDialog

Summary: _typescript_

Reviewed By: jknoxville

Differential Revision: D17284465

fbshipit-source-id: 1c874b320ca76455576b0a2b4db6e007e4e27e4b
This commit is contained in:
Daniel Büchele
2019-09-11 03:01:18 -07:00
committed by Facebook Github Bot
parent ded9d863f0
commit f2812aff7a

View File

@@ -116,8 +116,8 @@ class BugReporterDialog extends Component<Props, State> {
error: null,
};
titleRef: HTMLElement;
descriptionRef: HTMLElement;
titleRef?: HTMLElement;
descriptionRef?: HTMLElement;
onDescriptionChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
this.setState({description: e.target.value});
@@ -134,14 +134,18 @@ class BugReporterDialog extends Component<Props, State> {
this.setState({
error: 'Title required.',
});
if (this.titleRef) {
this.titleRef.focus();
}
return;
}
if (!description) {
this.setState({
error: 'Description required.',
});
if (this.descriptionRef) {
this.descriptionRef.focus();
}
return;
}
@@ -310,7 +314,8 @@ export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
plugins: {devicePlugins, clientPlugins},
connections: {selectedPlugin},
}) => ({
activePlugin:
devicePlugins.get(selectedPlugin) || clientPlugins.get(selectedPlugin),
activePlugin: selectedPlugin
? devicePlugins.get(selectedPlugin) || clientPlugins.get(selectedPlugin)
: null,
}),
)(BugReporterDialog);