Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Value for title can not be cast from ReadablenativeMap to string

InsertDataToServer = () => {
const { pinValue1 } = this.state;
const { pinValue2 } = this.state;
const { pinValue3 } = this.state;
const { pinValue4 } = this.state;
var String_3 = pinValue1.concat(" " , pinValue2);
var String_4 = String_3.concat(" " ,  pinValue3);
var String_5 = String_4.concat(" " ,  pinValue4);

fetch("http://www.aonde.biz/mobile/doLogin.php", {
  method: "POST",
  headers: {
    Accept: "application/json",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "pin":212,

  })
})
  .then(response => response.json())
  .then(responseJson => {
    // Showing response message coming from server after inserting records.
    Alert.alert(responseJson);
  })
  .catch(error => {
    console.error(error);
  });

In the above code when I pass pin parameter API then show this error. Thank youin image show full erro please give some idea how to resolve this issue.

like image 410
Atul Tiwari Avatar asked Oct 25 '18 15:10

Atul Tiwari


1 Answers

This error was fixed when code changed from:

Alert.alert('Error:', error)

to:

Alert.alert('Error:', error.message)

like image 174
Bill Zelenko Avatar answered Oct 21 '22 21:10

Bill Zelenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!