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

TypeError undefined is not an object (evaluating 'value.replace')

$
0
0

The strange thing is that it works on my web browser when I run it on Firefox using the Metro Bundler, but when I try to do it on an Android phone I get the error: TypeError undefined is not an object (evaluating 'value.replace')

const setMyString = (value) => {    let string = value.replace(/\D/g,'');    setString(string);}

It seems that this function sets the error.

const [myString, setString] = useState('');<Input       value={myString}    onChange={e => setMyString(e.target.value)} />

Here's the rest of the relevant code. The error happens when I use the virtual keyboard and enter a number.


Viewing all articles
Browse latest Browse all 29628

Trending Articles



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