Blank map on iOS
First time using react-native-maps. I've tried react-native link and manually linking everything together. I've made sure that everything is linked when using react-native link, deleted my builds, rebuilt my project, and even tried using this on a completely new project running React Native 0.41.0 with React 15.4.0-rc.4 but no matter what I do, the component never renders.
I've tried using react-native-maps 0.13 and 0.12.4 but neither worked...
Can you post your code? Nothing was rendering for me before I set an explicit width (height works fine)
Just gave that a try but it didn't work...
import React, { Component } from 'react';
import {
AppRegistry,
View
} from 'react-native';
import MapView from 'react-native-maps';
export default class myApp extends Component {
render() {
return (
<View style={{ width: 500 }}>
<MapView
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
/>
</View>
);
}
}
AppRegistry.registerComponent('myApp', () => myApp);
Just tried this with rn 0.39.2 and rn-maps 0.12.4. Same thing is happening :/
Thanks actually! What you suggested worked. Just needed to switch over to using a stylesheet:
import React, { Component } from 'react';
import { Text, View, Dimensions, ScrollView, StyleSheet } from 'react-native';
import { GradientView } from '../../Common'
import MapView from 'react-native-maps';
const { width, height } = Dimensions.get('window');
const SCREEN_WIDTH = width;
const ASPECT_RATIO = width / height;
const LATITUDE = 37.78825;
const LONGITUDE = -122.4324;
const LATITUDE_DELTA = 0.0922;
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;
export default class Analysis extends Component {
constructor(props) {
super(props);
this.state = {
region: {
latitude: LATITUDE,
longitude: LONGITUDE,
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,
},
};
}
render() {
return (
<View style={styles.container}>
<ScrollView
style={StyleSheet.absoluteFill}
contentContainerStyle={styles.scrollview}
>
<MapView
provider={this.props.provider}
style={styles.map}
scrollEnabled={true}
zoomEnabled={true}
pitchEnabled={true}
rotateEnabled={true}
initialRegion={this.state.region}
>
<MapView.Marker
title="This is a title"
description="This is a description"
coordinate={this.state.region}
/>
</MapView>
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
...StyleSheet.absoluteFillObject,
justifyContent: 'flex-end',
alignItems: 'center',
},
scrollview: {
alignItems: 'center',
},
map: {
width: SCREEN_WIDTH,
height: 250,
},
});
Happy it's working for you. TBC - not sure what was not working first, but the following piece of code works fine. So using Stylesheet is NOT a requirement:
import React, { Component } from 'react';
import { View, AppRegistry } from 'react-native';
//import { GradientView } from '../../Common'
import MapView from 'react-native-maps';
export default class sandbox extends Component {
render() {
return (
<View style={{ position: 'relative', height: 500}}>
<MapView
style={{ left:0, right: 0, top:0, bottom: 0, position: 'absolute' }}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
/>
</View>
);
}
}
Awesome, that code worked perfectly. Appreciate the help! 👍
I had a similar issue when updating to react-native 0.40.0, I tried adding a stylesheet and explicitly setting the width but it didn't work:
<MapView style={styles.map}
initialRegion={{
latitude: 37.78825,
longitude: -100.4324,
latitudeDelta: 150,
longitudeDelta: 150,
}}>
{this.state.markers.map(marker => (
<MapView.Marker
key={marker.id}
coordinate={marker.latlng}
title={marker.title}
description={marker.description}
pinColor={'#000000'}
/>
))}
</MapView>
Any ideas as to what might be happening?
Hi,
I have successfully implemented map on simulator. But while i am archiving the build i am getting following error -
Apple Mach-O Linker (ld) Error Group
ld: 396 duplicate symbols for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please help me
@rajeshkos I'd suggest you make a new issue for that. If I had to guess, it sounds like an issue with the linking process. Initialize a new project and try linking everything manually without react-native link.
Use instructions here as a guide: https://github.com/airbnb/react-native-maps/issues/693#issuecomment-259804156
This may help too: https://gist.github.com/heron2014/e60fa003e9b117ce80d56bb1d5bfe9e0
@rajeshkos i had the same issue , that's bc the new react native version links headers in different ways . Try to update your RN and React-Native Maps to the lastest version
Hey @rajeshkos, I actually ran into that issue yesterday. It came up when I removed react-native-maps and tried adding it back. Ended up having to rebuild my project from scratch :/
Hi @tedjames thanks for your reply.
I have created a new project from scratch but still unable to archive and facing same linker error.
I am able to run directly app on the device but no success while archiving. :(
Hmm.. post a screenshot of the file that the errors are pointing towards. We should be able to find a reference to what's causing the issue.
@arsanjea ,
CC: @airbnbelena , @bipinairbnb
I tried your snippet and it shows the rectangle only, no map showed.

Can you help me to fix this? Thanks.
+1
same. Only red border,no map shows. I use the option 3 to install and don't use google map support @ithieund have u fixed the bug yet,please? Thanks a lot
@zengyanzi The red border means it has not installed correctly, or you have not yet rebuilt the apk with airbnb maps installed. React-native link might not work for maps, as it did not for me. I had to follow the instalation guide as if i had not run link.
@Rubenvdabeele thanks a lot.I installed it from a brand new project and not it works fine. Thank you very much. I used the manually option 3..
@zengyanzi , Yes I solved it. Just follow this instruction: https://gist.github.com/heron2014/e60fa003e9b117ce80d56bb1d5bfe9e0
Thanks.
Running this and restarting the IOS Simulator fixed it for me. react-native link react-native-maps Read this: https://github.com/airbnb/react-native-maps/blob/master/docs/installation.md