Value for title can not be cast from ReadablenativeMap to string

value for uri cannot be cast from double to string
value for title cannot be cast from boolean to string
java lang boolean cannot be cast to java lang string react-native
java lang double cannot be cast to java lang string react-native
react native alert
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 you please give some idea how to resolve this issue.

You can simply remove double quotation marks from pin.

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

How to fix the error Value for title cannot be cast from ReadableNativeMap to String #24522. Closed. ashu777 opened this issue on Apr 18,  Description:- When i call the api using fetch method for post the image (in base64 format), i get following issue: "value for uri cannot be cast from readablenativemap to string". using react-native-customized-image-picker for image pick

This error was fixed when code changed from:

Alert.alert('Error:', error)

to:

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

UnexpectedNativeTypeException: Value for message cannot be cast from ReadableNativeMap to String #652. Closed. warrify opened this  As soon as I call init on the Sentry SDK my app crashes with UnexpectedNativeTypeException: Value for message cannot be cast from ReadableNativeMap to String. Though this only happens on Android and not on iOS. This issue was reported in the beta as well: #612 (comment) and #651 also seems related: react-native info

in your Alert.alert(responseJson); you need to stringify it like this

Alert.alert(JSON.stringify(responseJson));

keep in mind that alert is a component from the mobile app, so it might not understand the code showed there is a json, if that doesn't work, use responseJson.text()

Value for title cannot be cast from ReadableNativeMap to String. How to fix this issue in react native android? Value for title cannot be cast from  Value for path can not be cast from ReadableNativeMap to String. Steps to reproduce. Call ImagePicker.openPicker({multiple: true}).then(images => {//save image path as a uri in an array stored in state (will later be used as an Image component's source) i.e. this.state.tempArr = [] tempArr[0] = {uri: images[0].path}}) through a button press

the error was fixed when adding the title in the Alert method, as in the docs the title of Alert must be given while calling the Alert method

Value for title can not be cast from ReadablenativeMap to string - android. Firstly responseJson is an actual json object, you don't need to stringify it and then  Why GitHub? Features →. Code review; Project management; Integrations; Actions; Packages; Security

Make sure your alerts are displaying the error.MESSAGE and not the whole error. Depending on the error and its type that might be the cause!

That was the cause of my issue.

Ask questionsHow to fix the error Value for title cannot be cast from ReadableNativeMap to String. i am using: "axios": "^0.18.0", "native-base": "^2.12​.1", "react":  The first argument, called name is expected to be a string and you're providing an object { name: 'factsDB.db', createFromLocation: 1 }. That's why you get ReadableNativeMap cannot be cast to String —JS objects are parsed as ReadableNativeMap in native and it is not possible to pass it as an argument to a function expecting String .

finishTransaction crashes: ReadableNativeMap cannot be cast to java.lang. Ensure that you're passing a string value into requestSubscription it looks like  Attemp to invoke interface method java.lang.String com.facebook.react.bridge.ReadableMap etc on a null object reference 3 abi30_0_0.com.facebook.react.bridge.ReadableNativeMap cannot be cast to java.lang.String

Value for title can not be cast from ReadablenativeMap to string. 2018-10-25 15:​08 Atul Tiwari You can simply remove double quotation marks from pin . if the getResponse() returns String object but in reference of type Object, it is acceptable to get String as the respose is already string. in the other side, if the returned object actually not Object of String, it will gives you classcastexeption. to handle this case, it is recommended to check the type of the object before you cast it. like

Hi, does any one has any idea about the problem discussed in the following thread: InvalidCastException Basically, the problem is an InvalidCastException would be thrown with the following code in the .cs file of the DataSet (.xsd file): rtn_mesg = ((string)(command.Parameters[2].Value)); The code is actually trying to return a VARCHAR2 out parameter of a stored procedure.

Comments
  • I don't understand why you are only adding 212 as your pin even after you concatenate all the strings. However when I check with given URL and body as I suggested, I got status:1 output. I don't understand why you are saying the issue is occurring. If you can be more elaborate, I can help you.
  • can you share your code through you can get status 1? Thank you
  • I got the Status 1 using postman. But with the method I used in this answer, I did not get the error you are saying because you don't have to put key in double quotes when you are using stringify. Only the value if it is not numeric.