Created
October 20, 2018 15:32
-
-
Save jpomykala/ea762c3c9d6f2264b6d008001f11d9a7 to your computer and use it in GitHub Desktop.
method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onChangeShareValue = (newShareValue: number, ingredientRowIndex: number) => { | |
const { | |
values, | |
setValues | |
} = this.props; | |
const nextIngredients = [...values.ingredients]; | |
nextIngredients[ingredientRowIndex].shareAmount = newShareValue; | |
setValues({...values, ingredients: [...nextIngredients]}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Input | |
id={`ingredient_${id}_share`} | |
type="number" | |
name="ingredients" | |
value={value} | |
min="1" | |
onChange={(event) => { | |
const newValue = event.target.value; | |
this.onChangeShareValue(newValue, ingredientRowIndex); | |
}} | |
placeholder={valuePlaceholder} | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
validationSchema: Yup.object().shape({ | |
name: Yup.string().required(), | |
volume: Yup.number().max(50000).required(), | |
tax: Yup.number().min(0).max(100), | |
volumeType: Yup.string().required(), | |
packaging: Yup.string().required(), | |
}), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment