I have a component where i make an order estimation calculation ( a multiplication of quantity for his price ) in two cases
1) In the lifecycle method
componentDidMount(){
if (this.props.isRestarted) {
this.setState({
orderEstimation: this.props.formData.valNominal * this.props.formData.priceLimit,
})
}
2) In an Event
<FormAmountField
label={}
placeholder={}
value={this.state.price}
onChangeText={(value) => {
this.setState({
price: value,
orderEstimation: parseFloat(value) * parseFloat(this.state.quantity)
})
}}
As you can see in both cases: orderEstimation: parseFloat(value) * parseFloat(this.state.quantity)
I have a case when this.props.selectedTitleDetails.exchangeHost == "THIS_TEXT"
i want the the calculation changing parseFloat(value) * parseFloat(this.state.quantity) / 100
How can i apply this change in both cases? in the life cycle and the method?