0

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.

  1. 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.

  2. 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?

Smart Solutions
  • 869
  • 2
  • 10
  • 30
vg527
  • 11
  • 2
  • 6

0 Answers0