3/1/2023 0 Comments Google maps get coordsIn your android/app/adle file make sure you have this dependency: dependencies ) AppRegistry. This has a much easier set-up, especially if you ran react-native link react-native-maps since this command does must of the heavy lifting for you. If you want to use the same version as I did in this repo you can npm install react-native-maps -save Now onward to mapping!Īs a reference I’m following these docs, but I’ll walk you through all of my steps and include images that will hopefully help with the whole process of implementing a map into your project. We’re just going to be putting the map on the home screen of the project, so all the code will be in the file. Here are the React Native docs to help with that. If you’re having trouble with running your simulator you might need to install some other packages. Now you will want to cd into your project and run the command react-native run-ios, which should open your iOS simulator. Be sure to observe the proper formatting of the GPS coordinates so that Google Maps can interpret and find the location. Type in the latitude and longitude of the location in the search box on the upper left corner of the screen. On a side note, you can also create projects by the command create-react-native-app, but since we need to be linking I am using the older command line tools instead of having to deal with ejecting and plus I’ll have full control over my compiling.įirst I’m going to cover iOS development. Look for the Google Maps app on your mobile device and tap on it. npm i -g react-native-cli Next I created my project by the following command: react-native init MapExample (At the time of my build my react-native-maps was v0.15.3, react-native was v0.46.4 and React was v16.0.0-alpha.12) If you haven’t installed the React Native command line tools I would do so now. I was struggling through the documentation and received lots of Xcode errors during implementation, so that spurred me to write this tutorial in order to show you my steps that allowed me to eventually get a Google map on my simulator and phone! I am using react-native-maps to render a Google map on my phone.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |