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