Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6213

Nativebase React Native why can't i pass a number on an input

$
0
0

I'm using react native nativebase and i want to pass a number to my input value but im getting an error that says i cannot pass a number to a string.

<Input          keyboardType="numeric"          onChangeText={(text) => setTarget(text)}          value={target}        />

Now if I do this.

<Input          keyboardType="numeric"          // onChangeText={(text) => setTarget(text)}          value={"target"}

The error disappear.This is the definition of the value

const [target, setTarget] = useState<number>(0);

enter image description here


Viewing all articles
Browse latest Browse all 6213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>