0.1.1 • Published 11 days ago

expo-web-maps v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 days ago

expo-web-maps

react-native-maps extension with compatibility for expo web.

Utilizes the Google Maps JavaScript API

Requires additional setup with google

Installation

Expo

npx expo install expo-web-maps

Add the following to your app config:

...
web: {
  ...
  config: {
    ...
    googleMapsApiKey: YOUR_API_KEY,
  },
},

Then follow the additional iOS and Android installation instructions for react-native-maps: https://github.com/react-native-maps/react-native-maps/blob/master/docs/installation.md

Bare React Native

Use react-native-maps

Using the example app

  • Clone the project
git clone git@github.com:jmdoan1/expo-web-maps.git
  • cd into the project
cd expo-web-maps
  • install dependencies
npm i
cd example
npm i
cd ios
pod install
cd example #if necessary
npx expo start --web
  • Play around in the example/App.tsx file
    • All props are currently utilized in the example except for style

Supported Components

MapView

Props

PropertyDefaultiOSAndroidWebDescription
cacheEnabledfalseApple Maps onlySupportedNot supportedIf true map will be cached and displayed as an image instead of being interactable, for performance usage.
cameraSupportedSupportedSupportedThe camera view the map should display. Use the camera system, instead of the region system, if you need control over the pitch or heading.
compassOffsetApple Maps onlyNot supportedNot supportedIf set, changes the position of the compass.
customMapStyleGoogle Maps onlySupportedSupported (Do not use if using Marker components)Adds custom styling to the map component. See README for more information.
followsUserLocationfalseApple Maps onlyNot supportedNot supportedIf true the map will focus on the user's location. This only works if showsUserLocation is true and the user has shared their location.
initialCameraSupportedSupportedSupportedThe initial camera view the map should use. Use this prop instead of camera only if you don't want to control the camera of the map besides the initial view.
initialRegionSupportedSupportedSupportedThe initial region to be displayed by the map. Use this prop instead of region only if you don't want to control the viewport of the map besides the initial region.
kmlSrcGoogle Maps onlySupportedSupportedThe URL for KML file.
legalLabelInsetsApple Maps onlyNot supportedNot supportedIf set, changes the position of the "Legal" label link in Apple maps.
liteModeNot supportedSupportedNot supportedEnables lite mode on Android.
googleMapIdGoogle Maps onlySupportedSupported (Required if using Markers)Google cloud mapId to enable cloud styling and more.
googleRendererLATESTNot supportedSupportedNot supported. Use renderingTypeGoogle maps renderer.
loadingBackgroundColor#FFFFFFApple Maps onlySupportedSupportedSets loading background color.
loadingEnabledfalseApple Maps onlySupportedNot supportedIf true a loading indicator will show while the map is loading.
loadingIndicatorColor#606060Apple Maps onlySupportedNot supportedSets loading indicator color.
mapPaddingSupportedSupportedNot supported -- TODOAdds custom padding to each side of the map. Useful when map elements/markers are obscured.
mapTypestandardhybrid, mutedStandard, satellite, standard, terrain, hybridFlyover, satelliteFlyoverhybrid, none, satellite, standard, terrainNot supported. Use mapTypeWebThe map type to be displayed.
mapTypeWebNot supportedNot supportedhybrid, roadmap, satellite, terrainThe map type to be displayed.
maxDeltaApple Maps onlyNot supportedNot supportedTODO: Add documentation
maxZoomLevel20SupportedSupportedSupportedMaximum zoom value for the map, must be between 0 and 20.
minDeltaApple Maps onlyNot supportedNot supportedTODO: Add documentation
minZoomLevel0SupportedSupportedSupportedMinimum zoom value for the map, must be between 0 and 20.
moveOnMarkerPresstrueNot supportedSupportedTODOIf false the map won't move to the marker when pressed.
onCalloutPressApple Maps onlySupportedTODOCallback that is called when a callout is tapped by the user.
onDoublePressApple Maps onlySupportedSupportedCallback that is called when user double taps on the map.
onIndoorBuildingFocusedGoogle Maps onlySupportedTODOCallback that is called when an indoor building is focused/unfocused.
onIndoorLevelActivatedGoogle Maps onlySupportedTODOCallback that is called when a level on indoor building is activated.
onKmlReadyGoogle Maps onlySupportedPartially supported (returns empty event)Callback that is called once the kml is fully loaded.
onLongPressSupportedSupportedTODOCallback that is called when user makes a "long press" somewhere on the map.
onMapLoadedGoogle Maps onlySupportedPartially supported (returns empty event)Callback that is called when the map has finished rendering all tiles.
onMapReadySupportedSupportedNot supportedCallback that is called once the map is ready.
onMarkerDeselectSupportedSupportedTODOCallback that is called when a marker on the map becomes deselected.
onMarkerDragApple Maps onlySupportedTODOCallback called continuously as a marker is dragged.
onMarkerDragEndApple Maps onlySupportedTODOCallback that is called when a drag on a marker finishes.
onMarkerDragStartApple Maps onlySupportedTODOCallback that is called when the user initiates a drag on a marker (if it is draggable).
onMarkerPressSupportedSupportedTODOCallback that is called when a marker on the map is tapped by the user.
onMarkerSelectSupportedSupportedTODOCallback that is called when a marker on the map becomes selected.
onPanDragSupportedSupportedTODOCallback that is called when user presses and drags the map.
onPoiClickGoogle Maps onlySupportedTODOCallback that is called when user click on a POI.
onPressSupportedSupportedSupportedCallback that is called when user taps on the map.
onRegionChangeSupportedSupportedTODOCallback that is called continuously when the region changes.
onRegionChangeCompleteSupportedSupportedTODOCallback that is called once when the region changes.
onUserLocationChangeSupportedSupportedTODOCallback that is called when the underlying map figures our users current location.
paddingAdjustmentBehaviorGoogle Maps onlyNot supportedNot supportedIndicates how/when to affect padding with safe area insets.
pitchEnabledtrueGoogle Maps onlySupportedTODOIf false the user won't be able to adjust the camera’s pitch angle.
providerSupportedSupportedSupportedThe map framework to use.
regionSupportedSupportedSupportedThe region to be displayed by the map.
renderingTypeRASTERNot supportedNot supportedSupportedGoogle maps rendering type.
rotateEnabledtrueGoogle Maps onlySupportedTODOIf false the user won't be able to adjust the camera’s pitch angle.
scrollDuringRotateOrZoomEnabledtrueGoogle Maps onlySupportedTODOIf false the map will stay centered while rotating or zooming.
scrollEnabledtrueSupportedSupportedTODOIf false the user won't be able to change the map region being displayed.
showsBuildingstrueNot supportedSupportedTODOA Boolean indicating whether the map displays extruded building information.
showsCompasstrueSupportedSupportedNot supportedIf false compass won't be displayed on the map.
showsIndoorLevelPickerfalseGoogle Maps onlySupportedTODOA Boolean indicating whether indoor level picker should be enabled.
showsIndoorstrueGoogle Maps onlySupportedTODOA Boolean indicating whether indoor maps should be enabled.
showsMyLocationButtontrueGoogle Maps onlySupportedTODOIf false hide the button to move map to the current user's location.
showsPointsOfInteresttrueMaybe Apple Maps?Not supportedTODOIf false points of interest won't be displayed on the map.
showsScaletrueApple Maps onlyNot supportedNot supportedA Boolean indicating whether the map shows scale information.
showsTrafficfalseSupportedNot supported?SupportedA Boolean value indicating whether the map displays traffic information.
showsUserLocationfalseSupportedSupportedTODOIf true the users location will be displayed on the map. This will cause iOS to ask for location permissions.
tintColorSystem BlueApple Maps onlyNot supportedNot supportedSets the tint color of the map. (Changes the color of the position indicator)
toolbarEnabledtrueNot supportedSupportedTODO?If false will hide 'Navigate' and 'Open in Maps' buttons on marker press.
userInterfaceStyleSystem settingApple Maps only (iOS >= 13.0)Not supportedNot supportedSets the map to the style selected.
userLocationAnnotationTitleMy LocationApple Maps onlyNot supportedNot supportedThe title of the annotation for current user location.
userLocationCalloutEnabledfalseApple Maps onlyNot supportedNot supportedIf true clicking user location will show the default callout for userLocation annotation.
userLocationFastestInterval5000Not supportedSupportedTODO?Fastest interval the application will actively acquire locations.
userLocationPriorityhighNot supportedSupportedTODO?Set power priority of user location tracking.
userLocationUpdateInterval5000Not supportedSupportedTODO?Interval of user location updates in milliseconds.
zoomControlEnabledtrueNot supportedSupportedSupportedIf false the zoom control at the bottom right of the map won't be visible.
zoomEnabledtrueSupportedSupportedTODOIf false the user won't be able to pinch/zoom the map.
zoomTapEnabledtrueGoogle Maps onlyNot supportedTODO?If false the user won't be able to double tap to zoom the map.
cameraZoomRange13.0+Not supportedNot supportedMap camera distance limits. minCenterCoordinateDistance for minimum distance, maxCenterCoordinateDistance for maximum.

Marker

Props

Integration Pending

Callout

Props

Integration Pending

TODO

  • Additional MapViewProps integration
  • Marker props integration
  • Callout props integration
  • Add other components from react-native-web
    • Polygon
    • Polyline
    • Circle
    • Overlay
    • Heatmap
    • Geojson

All documentation below this line was autogenerated and serves only as a placeholder

API documentation

Installation in managed Expo projects

For managed Expo projects, please follow the installation instructions in the API documentation for the latest stable release. If you follow the link and there is no documentation available then this library is not yet usable within managed projects it is likely to be included in an upcoming Expo SDK release.

Installation in bare React Native projects

For bare React Native projects, you must ensure that you have installed and configured the expo package before continuing.

Add the package to your npm dependencies

npm install expo-web-maps

Configure for iOS

Run npx pod-install after installing the npm package.

Configure for Android

Contributing

Contributions are very welcome! Please refer to guidelines described in the contributing guide.