Here is my code -
const StartGameScreen = props => {
const [enteredValue, setEnteredValue] = useState('');
const numberInputHandler = inputText => {
setEnteredValue(inputText);
};
const resetInputHandler = () => {
setEnteredValue('');
};
return (
<View>
<TextInput
blurOnSubmit
autoCapitalize="none"
autoCorrect={false}
keyboardType="number-pad"
maxLength={2}
onChangeText={numberInputHandler}
value={enteredValue}
/>
<View style={styles.button}>
<Button title="Reset" onPress={resetInputHandler}/>
</View>
</View>
);
I am having a couple of issues with the above code.
I am calling
numberInputHandler
function onChangeText, but the value is not updated. Similary, onPress of Reset button I am calling another function "resetInputHandler", it's not working too.keyboardType="number-pad"
is not working. I am able to see the normal keyboard in both iPhone and android simulator.
Would you please help to resolve the above issues?