0

Im Dynamically editing flatlist item TextInput value using OnChangeText(). but default value of onchangetext is string but i want numeric. so im type casting to number. but while type casting onchangetext value to number not able to enter decimal. here is my code

<TextInput
                    style={[styles.cellText, { width: 150 }]}
                    value={isNaN(item.load_avg) ? '' : item.load_avg.toString()}
                    keyboardType="numeric"
                    onChangeText={(text) => {
                        const { wind_data } = this.state
                        isBlank(wind_data.windDieselEquipment) ? null : wind_data.windDieselEquipment[index].load_avg = Number(text.replace(/[- #*;,<>\{\}\[\]\\\/]/gi, ''))
                        this.setState({
                            wind_data
                        })
                    }}
                />

0 Answers0