chat: submit color on blur
@@ -23,6 +23,7 @@ export class SettingsScreen extends Component {
this.changeTitle = this.changeTitle.bind(this);
this.changeDescription = this.changeDescription.bind(this);
this.changeColor = this.changeColor.bind(this);
+ this.submitColor = this.submitColor.bind(this);
}
componentDidMount() {
@@ -55,9 +56,23 @@ export class SettingsScreen extends Component {
color: `#${uxToHex(props.association.metadata.color)}`
});
}
+ }
+
+ changeTitle() {
+ this.setState({title: event.target.value})
+ }
+
+ changeDescription() {
+ this.setState({description: event.target.value});
+ }
+
+ changeColor() {
+ this.setState({color: event.target.value});
+ }
+
+ submitColor() {
+ let { props, state } = this;
- if (state.color !== prevState.color) {
- //submit color if valid
let color = state.color;
if (color.startsWith("#")) {
color = state.color.substr(1);
@@ -89,19 +104,6 @@ export class SettingsScreen extends Component {
}
}
}
- }
-
- changeTitle() {
- this.setState({title: event.target.value})
- }
-
- changeDescription() {
- this.setState({description: event.target.value});
- }
-
- changeColor() {
- this.setState({color: event.target.value});
- }
deleteChat() {
const { props, state } = this;
@@ -223,6 +225,7 @@ export class SettingsScreen extends Component {
value={this.state.color}
disabled={!chatOwner}
onChange={this.changeColor}
+ onBlur={this.submitColor}
/>
</div>
</div>
