Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not work on react-native-web

See original GitHub issue

I tried this simple example:

function TestGoogleAutoComplete() {
  return (
      <GoogleAutoComplete apiKey={GOOGLE_API_KEY}>
        {({ handleTextChange, locationResults }) => (
            {console.log("locationResults: ", locationResults)}
                placeholder="Search a place"
                  height: 40,
                  width: 300,
                  borderWidth: 1,
                  paddingHorizontal: 16,

The console.log is working on expo go (on mobile) But when i try to run on web it shows this error on the console.log:

Access to fetch at '***&language=en&types=address' from origin 'http://localhost:19006' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

it should work on web, right? u told on this part of the vídeo that should: what should i do?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

EQuimpercommented, Dec 8, 2021

@hiwyn I don’t have my pc with me now. But here can you update in your node_module/react-native-google-autocomplete those fetch and

Add fetch(url, { mode: 'no-cors' }); and see if that fix your problem. If we I will update the lib. I just don’t work with this lib on web.

I ask you to do it just because I can’t fix it until tomorrow so if you need that now you can have this fix until.

hiwyncommented, Jan 13, 2022

The issue with the cors is not fix with fetch no-cors options. And also the other solution of using cors-anywhere don’t work too.

Look like the solution is to use the official sdk. I don’t use react-native web, so this wasn’t really in my plan to do.

@MiguelNiblock sorry about that

A lot of people use RN WEB, even more now with expo, so pls at least put on the readme that u do not support rn-web so people don’t waste time

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · necolas/react-native-web - GitHub
Contribute to necolas/react-native-web development by creating an account on GitHub. ... Scroll does not work for TextInput nested in inverted FlatList bug.
Read more >
React Native Webview not loading any url ... - Stack Overflow
I am trying to implement react native webview component in my application, but the web view is not loading any url its just...
Read more >
Troubleshooting - React Native
These are some common issues you may run into while setting up React Native. If you encounter something that is not listed here,...
Read more >
react-native-web - npm
Start using react-native-web in your project by running `npm i ... You'll notice that there is no reference to react-dom in components.
Read more >
React Native for Web
You can try React Native for Web from your browser using the official template on CodeSandbox. Fork the template and create your own...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found