Validation checks added

This commit is contained in:
wmwragg 2016-09-06 17:46:00 +01:00
parent 52f050b5f9
commit 45256f5d58

View File

@ -71,14 +71,23 @@ module.exports = React.createClass({
componentDidUpdate: function() { componentDidUpdate: function() {
// As the user scrolls with the arrow keys keep the selected item // As the user scrolls with the arrow keys keep the selected item
// at the top of the window. Each item is 29px high. // at the top of the window. Each item is 29px high.
this.scrollElement.scrollTop = (this.state.selected * 29) - 29; if (this.scrollElement) {
this.scrollElement.scrollTop = (this.state.selected * 29) - 29;
}
}, },
onStartChat: function() { onStartChat: function() {
var addr;
// Either an address tile was created, or text input is being used
if (this.state.user) { if (this.state.user) {
this._startChat(this.state.user.userId); addr = this.state.user.userId;
} else if (this.refs.textinput.value.length > 0) { } else {
this._startChat(this.refs.textinput.value); addr = this.refs.textinput.value;
}
// Check if the addr is a valid type
if (Invite.getAddressType(addr) !== null) {
this._startChat(addr);
} else { } else {
// Nothing to do, so focus back on the textinput // Nothing to do, so focus back on the textinput
this.refs.textinput.focus(); this.refs.textinput.focus();
@ -232,8 +241,7 @@ module.exports = React.createClass({
render: function() { render: function() {
var TintableSvg = sdk.getComponent("elements.TintableSvg"); var TintableSvg = sdk.getComponent("elements.TintableSvg");
console.log("### D E B U G - queryList:"); this.scrollElement = null;
console.log(this.state.queryList);
var query; var query;
if (this.state.addressSelected) { if (this.state.addressSelected) {