Limit length
This commit is contained in:
@@ -70,21 +70,25 @@ export default class Temp extends Component {
|
|||||||
<TextInput
|
<TextInput
|
||||||
style={styles.temperatureTextInput}
|
style={styles.temperatureTextInput}
|
||||||
onChangeText={(val) => {
|
onChangeText={(val) => {
|
||||||
|
if (isNaN(Number(val))) return
|
||||||
this.setState({ integer: val })
|
this.setState({ integer: val })
|
||||||
}}
|
}}
|
||||||
keyboardType='numeric'
|
keyboardType='numeric'
|
||||||
value={this.state.integer}
|
value={this.state.integer}
|
||||||
onBlur={this.checkRange}
|
maxLength={2}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.temperatureTextInput}>.</Text>
|
<Text style={styles.temperatureTextInput}>.</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
style={styles.temperatureTextInput}
|
style={styles.temperatureTextInput}
|
||||||
onChangeText={(val) => {
|
onChangeText={(val) => {
|
||||||
|
if (isNaN(Number(val))) return
|
||||||
this.setState({ fractional: val })
|
this.setState({ fractional: val })
|
||||||
}}
|
}}
|
||||||
keyboardType='numeric'
|
keyboardType='numeric'
|
||||||
value={this.state.fractional}
|
value={this.state.fractional}
|
||||||
onBlur={this.checkRange}
|
onBlur={this.checkRange}
|
||||||
|
maxLength={2}
|
||||||
|
autoFocus={true}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user