简体   繁体   中英

How to use Open Street Map with React-native

As beginner in react-native, I'm looking for a library in react native that may support map visualization (Open street Map) on react-native.

Therefore I found out: react-native-open-street-map -- but this works only for android, react-native-webview-leaflet -- but no more supported since 2years. Have you alternative solutions that may help me?

Please, I'm avoiding Google Maps, I need a priceless solution.

would suggest go for https://github.com/react-native-maps/react-native-maps as this is much maintainable library then previous one and then use it as follows

import MapView, {Marker, Callout, PROVIDER_GOOGLE} from 'react-native-maps';
getInitialState() {
  return {
    region: {
      latitude: 37.78825,
      longitude: -122.4324,
      latitudeDelta: 0.0922,
      longitudeDelta: 0.0421,
    },
  };
}

onRegionChange(region) {
  this.setState({ region });
}

render() {
  return (
    <MapView
      region={this.state.region}
      onRegionChange={this.onRegionChange}
    />
  );
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM