I am new to react native and am trying to add a google map to my app.
I started by installing react-native-maps and creating a new file with the following code.
import React from 'react';
import MapView, { PROVIDER_GOOGLE } from 'react-native-maps';
export default class MapScreen extends React.Component {
render() {
return (
<MapView
provider={ PROVIDER_GOOGLE }
style={{flex: 1}}
region={{
latitude: 54.721344,
longitude: -6.199981
}}
showsUserLocation={true} />
);
}
}
After this I added the following code to the Podfile file found in the ios folder.
target 'MapExamplw' do
pod 'Yoga', path: "./node_modules/react-native/ReactCommon/yoga/Yoga.podspec"
pod 'GoogleMaps'
end
After getting my api key from google, I opened Xcode and added the AirGoogleMap folder to my project. I then went into my build settings and add 'HAVE_GOOGLE_MAPS+1' to Preprocessor Macros Macros.
Next I went into my AppDelegate.m file and added the following lines
@import GoogleMaps;
[GMSServices provideAPIKey:@"YOUR_API_KEY"]
After all this was done I ran my app in the iOS simulator and when I did this an error appeared as shown below.
I am unsure as to why I am getting this error as I have added the AirGoogleMap to my project via Xcode. Is there any way to fix this?