Flipper sent messages while editing
Summary: In previous version when you edited something in the flipper, after each symbol flipper sent a message to edit a value to mobile side. Now "change message" will be sent only after pressing "Enter" button. Reviewed By: priteshrnandgaonkar Differential Revision: D16338101 fbshipit-source-id: 6605663d0b0059fdb2d20cb279e133afc25d47f1
This commit is contained in:
committed by
Facebook Github Bot
parent
89911acd84
commit
cb374ffccd
@@ -73,6 +73,7 @@ type DescriptionCommitOptions = {|
|
|||||||
value: any,
|
value: any,
|
||||||
keep: boolean,
|
keep: boolean,
|
||||||
clear: boolean,
|
clear: boolean,
|
||||||
|
set: boolean,
|
||||||
|};
|
|};
|
||||||
|
|
||||||
class NumberTextEditor extends PureComponent<{
|
class NumberTextEditor extends PureComponent<{
|
||||||
@@ -90,6 +91,7 @@ class NumberTextEditor extends PureComponent<{
|
|||||||
clear: false,
|
clear: false,
|
||||||
keep: true,
|
keep: true,
|
||||||
value: val,
|
value: val,
|
||||||
|
set: false,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -99,12 +101,13 @@ class NumberTextEditor extends PureComponent<{
|
|||||||
this.props.type === 'number'
|
this.props.type === 'number'
|
||||||
? parseFloat(this.props.value)
|
? parseFloat(this.props.value)
|
||||||
: this.props.value;
|
: this.props.value;
|
||||||
this.props.commit({clear: true, keep: true, value: val});
|
this.props.commit({clear: true, keep: true, value: val, set: true});
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
this.props.commit({
|
this.props.commit({
|
||||||
clear: true,
|
clear: true,
|
||||||
keep: false,
|
keep: false,
|
||||||
value: this.props.origValue,
|
value: this.props.origValue,
|
||||||
|
set: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -116,7 +119,12 @@ class NumberTextEditor extends PureComponent<{
|
|||||||
};
|
};
|
||||||
|
|
||||||
onNumberTextBlur = () => {
|
onNumberTextBlur = () => {
|
||||||
this.props.commit({clear: true, keep: true, value: this.props.value});
|
this.props.commit({
|
||||||
|
clear: true,
|
||||||
|
keep: true,
|
||||||
|
value: this.props.value,
|
||||||
|
set: true,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -170,8 +178,10 @@ export default class DataDescription extends PureComponent<
|
|||||||
if (opts.keep && setValue && path) {
|
if (opts.keep && setValue && path) {
|
||||||
const val = opts.value;
|
const val = opts.value;
|
||||||
this.setState({value: val});
|
this.setState({value: val});
|
||||||
|
if (opts.set) {
|
||||||
setValue(path, val);
|
setValue(path, val);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (opts.clear) {
|
if (opts.clear) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -250,7 +260,12 @@ class ColorEditor extends Component<{
|
|||||||
commit: (opts: DescriptionCommitOptions) => void,
|
commit: (opts: DescriptionCommitOptions) => void,
|
||||||
}> {
|
}> {
|
||||||
onBlur = () => {
|
onBlur = () => {
|
||||||
this.props.commit({clear: true, keep: false, value: this.props.value});
|
this.props.commit({
|
||||||
|
clear: true,
|
||||||
|
keep: false,
|
||||||
|
value: this.props.value,
|
||||||
|
set: true,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onChange = ({
|
onChange = ({
|
||||||
@@ -288,7 +303,7 @@ class ColorEditor extends Component<{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.props.commit({clear: false, keep: true, value: val});
|
this.props.commit({clear: false, keep: true, value: val, set: true});
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -435,7 +450,12 @@ class DataDescriptionContainer extends Component<{
|
|||||||
commit: (opts: DescriptionCommitOptions) => void,
|
commit: (opts: DescriptionCommitOptions) => void,
|
||||||
}> {
|
}> {
|
||||||
onChangeCheckbox = (e: SyntheticInputEvent<HTMLInputElement>) => {
|
onChangeCheckbox = (e: SyntheticInputEvent<HTMLInputElement>) => {
|
||||||
this.props.commit({clear: true, keep: true, value: e.target.checked});
|
this.props.commit({
|
||||||
|
clear: true,
|
||||||
|
keep: true,
|
||||||
|
value: e.target.checked,
|
||||||
|
set: true,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
render(): any {
|
render(): any {
|
||||||
|
|||||||
Reference in New Issue
Block a user