Cannot run this React Native example in web browser

Viewed 198

Code example I am trying to run: https://github.com/nshaposhnik/react-native-maps-example

I am on windows 10.

What I do:

  • Downloaded the code

  • Extracted to folder

  • Setup with the following after deleting yarn.lock:

    yarn add react-native-maps

    yarn add react-native-maps-directions

    yarn add react-native-google-places-autocomplete

    npm install

    npm audit fix

  • Edit the code in the 3 places that requires my custom google API key which I got from the developer site

  • Tried running via:

    npm start

I get a successful run in the terminal (" Welcome to React Native! Learn once, write anywhere"), but no browser opens up. I go to localhost:8081 in my browser and see a barren webpage with the following text:

React Native packager is running.

Visit documentation

That's all. Nothing in the sample project runs. I just want to run their app in a browser or emulator, though I don't have any of the phone emulators working, so I just want to run in web browser.

How can I make this work from the above example? Much appreciated.

1 Answers

You have to run emulator separately on "Windows" using android studio or command line, and after open your project using VsCode(or your editor) and the run following command ,

react-native run-android

Your app will run on your opened emulator

Related