Error evaluating injectedJavaScript: This is possibly due to an unsupported return type. Try adding true to the end of your injectedJavaScript string.

See original GitHub issue

Hello,

We’re trying to migrate from react-native WebView. Replacing import { WebView } from 'react-native' with import { WebView } from 'react-native-webview' gives us this error when the component is mounted:

Error evaluating injectedJavaScript: This is possibly due to an unsupported return type. Try adding true to the end of your injectedJavaScript string.

I’ve tried to add ; true or ; return true at the end of the injected script but we still get the same error.

Do you know how we can fix it or identify the underlying problem?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:22
  • Comments:30 (1 by maintainers)

github_iconTop GitHub Comments

104reactions
sillysachincommented, Feb 23, 2019

Fixed using a timer.

const jsCode = `
    setTimeout(() => {
        document.getElementById("name").value = "${name}"; 
        document.f1.submit(); 
    }, 100);
`;
58reactions
legion-zvercommented, Feb 18, 2019

See your JS code carefully, this error is due to the fact that WebView can not execute JS code!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use RegExp in React-Native Webview's ...
When I use regexp in React-Native-Webview's injectedJavaScript prop, an error Unterminated regular expression literal error ...
Read more >
Need help with react-native Webview, injecting react ... - Reddit
What should I do if I'm trying to pass data from react native into the javascript string that's executed by the webview? webviewRef.current....
Read more >
WebView InjectedJavaScript - Expo Snack
Try this project on your phone! Use Expo's online editor to make changes and save your own copy.
Read more >
humanoids/react-native-recaptcha - npm.io
Error evaluating injectedJavaScript : This is possibly due to an unsupported return type. Try adding true to the end of your injectedJavaScript string....
Read more >
react-native-webview - UNPKG
... evaluating injectedJavaScript: This is possibly due to an unsupported return type. Try adding true to the end of your injectedJavaScript string.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found