mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Fix error message not cleared after choosing a color in a color picker (#5794)
This commit is contained in:
@@ -23,13 +23,13 @@ export default React.forwardRef<ParameterFieldProps, ParameterFieldInterface>(
|
||||
<GenericExpressionField
|
||||
expressionType="string"
|
||||
ref={field}
|
||||
renderExtraButton={({ style }) => (
|
||||
renderExtraButton={({ style, onChange }) => (
|
||||
<ColorPicker
|
||||
style={style}
|
||||
disableAlpha
|
||||
color={rgbStringAndAlphaToRGBColor(props.value)}
|
||||
onChangeComplete={color => {
|
||||
props.onChange(
|
||||
onChange(
|
||||
'"' + color.rgb.r + ';' + color.rgb.g + ';' + color.rgb.b + '"'
|
||||
);
|
||||
}}
|
||||
|
@@ -115,6 +115,7 @@ type Props = {|
|
||||
) => ?string,
|
||||
renderExtraButton?: ({|
|
||||
style: Object,
|
||||
onChange: (newValue: string) => void,
|
||||
|}) => React.Node,
|
||||
...ParameterFieldProps,
|
||||
|};
|
||||
@@ -232,8 +233,7 @@ export default class ExpressionField extends React.Component<Props, State> {
|
||||
);
|
||||
};
|
||||
|
||||
_handleBlur = (event: { currentTarget: { value: string } }) => {
|
||||
const value = event.currentTarget.value;
|
||||
_handleBlur = (value: string) => {
|
||||
if (this.props.onChange) this.props.onChange(value);
|
||||
this.setState({ validatedValue: value }, () => {
|
||||
this._enqueueValidation.cancel();
|
||||
@@ -244,6 +244,10 @@ export default class ExpressionField extends React.Component<Props, State> {
|
||||
});
|
||||
};
|
||||
|
||||
_handleBlurEvent = (event: { currentTarget: { value: string } }) => {
|
||||
this._handleBlur(event.currentTarget.value);
|
||||
};
|
||||
|
||||
_shouldOpenParametersDialog = (
|
||||
expressionInfo: EnumeratedExpressionMetadata
|
||||
): boolean => {
|
||||
@@ -492,6 +496,7 @@ export default class ExpressionField extends React.Component<Props, State> {
|
||||
},
|
||||
completionDescriptions
|
||||
);
|
||||
|
||||
const allNewAutocompletions = onGetAdditionalAutocompletions
|
||||
? onGetAdditionalAutocompletions(expression).concat(newAutocompletions)
|
||||
: newAutocompletions;
|
||||
@@ -571,7 +576,7 @@ export default class ExpressionField extends React.Component<Props, State> {
|
||||
hintText={expressionType === 'string' ? '""' : undefined}
|
||||
inputStyle={styles.input}
|
||||
onChange={this._handleChange}
|
||||
onBlur={this._handleBlur}
|
||||
onBlur={this._handleBlurEvent}
|
||||
ref={field => (this._field = field)}
|
||||
onFocus={this._handleFocus}
|
||||
errorText={this.state.errorText}
|
||||
@@ -677,6 +682,7 @@ export default class ExpressionField extends React.Component<Props, State> {
|
||||
this.props.renderExtraButton &&
|
||||
this.props.renderExtraButton({
|
||||
style,
|
||||
onChange: this._handleBlur,
|
||||
})}
|
||||
{!this.props.isInline && (
|
||||
<RaisedButton
|
||||
|
Reference in New Issue
Block a user