mirror of
https://github.com/status-im/react-native.git
synced 2025-02-05 06:04:15 +00:00
Update MapView doc
Summary: Reference: #8203 Changes made: - Added a MapView example to the intro section - Added more details to prop explanations - Added more info to an exported type, even if it's not used anywhere I can see - Removed mention of ios platform in props. Left an android one in there as I didn't want to touch code. **Test plan (required)** Ran the website locally and checked: http://localhost:8079/react-native/docs/mapview.html ![component_mapview_2](https://cloud.githubusercontent.com/assets/691109/16329753/43419508-3999-11e6-9310-11c53ca8c04b.png) Closes https://github.com/facebook/react-native/pull/8389 Differential Revision: D3481609 Pulled By: JoelMarcey fbshipit-source-id: 71e35ce49193dc09d40546ff16bc48559135d63f
This commit is contained in:
parent
d29e8ae0ca
commit
82b99a1ca3
@ -27,21 +27,58 @@ const requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
type Event = Object;
|
||||
|
||||
/**
|
||||
* State an annotation on the map.
|
||||
*/
|
||||
export type AnnotationDragState = $Enum<{
|
||||
/**
|
||||
* Annotation is not being touched.
|
||||
*/
|
||||
idle: string;
|
||||
/**
|
||||
* Annotation dragging has began.
|
||||
*/
|
||||
starting: string;
|
||||
/**
|
||||
* Annotation is being dragged.
|
||||
*/
|
||||
dragging: string;
|
||||
/**
|
||||
* Annotation dragging is being canceled.
|
||||
*/
|
||||
canceling: string;
|
||||
/**
|
||||
* Annotation dragging has ended.
|
||||
*/
|
||||
ending: string;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* A component for displaying embeddable maps and annotations using the native
|
||||
* iOS MKMapView class. The Android version is not currently available in the
|
||||
* open source React Native project, but you can use Leland Richardson's
|
||||
* cross-platform and more feature-complete
|
||||
* **This component is only supported on iOS.**
|
||||
*
|
||||
* `MapView` is used to display embeddable maps and annotations using
|
||||
* `MKMapView`.
|
||||
*
|
||||
* For a cross-platform solution, check out
|
||||
* [react-native-maps](https://github.com/lelandrichardson/react-native-maps)
|
||||
* instead.
|
||||
* by Leland Richardson.
|
||||
*
|
||||
* ```
|
||||
* import React, { Component } from 'react';
|
||||
* import { MapView } from 'react-native';
|
||||
*
|
||||
* class MapMyRide extends Component {
|
||||
* render() {
|
||||
* return (
|
||||
* <MapView
|
||||
* style={{height: 200, margin: 40}}
|
||||
* showsUserLocation={true}
|
||||
* />
|
||||
* );
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
|
||||
const MapView = React.createClass({
|
||||
@ -51,8 +88,7 @@ const MapView = React.createClass({
|
||||
propTypes: {
|
||||
...View.propTypes,
|
||||
/**
|
||||
* Used to style and layout the `MapView`. See `StyleSheet.js` and
|
||||
* `ViewStylePropTypes.js` for more info.
|
||||
* Used to style and layout the `MapView`.
|
||||
*/
|
||||
style: View.propTypes.style,
|
||||
|
||||
@ -60,7 +96,7 @@ const MapView = React.createClass({
|
||||
* If `true` the app will ask for the user's location and display it on
|
||||
* the map. Default value is `false`.
|
||||
*
|
||||
* **NOTE**: on iOS, you need to add the `NSLocationWhenInUseUsageDescription`
|
||||
* **NOTE**: You'll need to add the `NSLocationWhenInUseUsageDescription`
|
||||
* key in Info.plist to enable geolocation, otherwise it will fail silently.
|
||||
*/
|
||||
showsUserLocation: React.PropTypes.bool,
|
||||
@ -69,21 +105,18 @@ const MapView = React.createClass({
|
||||
* If `true` the map will follow the user's location whenever it changes.
|
||||
* Note that this has no effect unless `showsUserLocation` is enabled.
|
||||
* Default value is `true`.
|
||||
* @platform ios
|
||||
*/
|
||||
followUserLocation: React.PropTypes.bool,
|
||||
|
||||
/**
|
||||
* If `false` points of interest won't be displayed on the map.
|
||||
* Default value is `true`.
|
||||
* @platform ios
|
||||
*/
|
||||
showsPointsOfInterest: React.PropTypes.bool,
|
||||
|
||||
/**
|
||||
* If `false` compass won't be displayed on the map.
|
||||
* If `false`, compass won't be displayed on the map.
|
||||
* Default value is `true`.
|
||||
* @platform ios
|
||||
*/
|
||||
showsCompass: React.PropTypes.bool,
|
||||
|
||||
@ -96,7 +129,9 @@ const MapView = React.createClass({
|
||||
/**
|
||||
* When this property is set to `true` and a valid camera is associated with
|
||||
* the map, the camera’s heading angle is used to rotate the plane of the
|
||||
* map around its center point. When this property is set to `false`, the
|
||||
* map around its center point.
|
||||
*
|
||||
* When this property is set to `false`, the
|
||||
* camera’s heading angle is ignored and the map is always oriented so
|
||||
* that true north is situated at the top of the map view
|
||||
*/
|
||||
@ -105,7 +140,9 @@ const MapView = React.createClass({
|
||||
/**
|
||||
* When this property is set to `true` and a valid camera is associated
|
||||
* with the map, the camera’s pitch angle is used to tilt the plane
|
||||
* of the map. When this property is set to `false`, the camera’s pitch
|
||||
* of the map.
|
||||
*
|
||||
* When this property is set to `false`, the camera’s pitch
|
||||
* angle is ignored and the map is always displayed as if the user
|
||||
* is looking straight down onto it.
|
||||
*/
|
||||
@ -120,11 +157,9 @@ const MapView = React.createClass({
|
||||
/**
|
||||
* The map type to be displayed.
|
||||
*
|
||||
* - standard: standard road map (default)
|
||||
* - satellite: satellite view
|
||||
* - hybrid: satellite view with roads and points of interest overlaid
|
||||
*
|
||||
* @platform ios
|
||||
* - `standard`: Standard road map (default).
|
||||
* - `satellite`: Satellite view.
|
||||
* - `hybrid`: Satellite view with roads and points of interest overlaid.
|
||||
*/
|
||||
mapType: React.PropTypes.oneOf([
|
||||
'standard',
|
||||
@ -154,8 +189,7 @@ const MapView = React.createClass({
|
||||
}),
|
||||
|
||||
/**
|
||||
* Map annotations with title/subtitle.
|
||||
* @platform ios
|
||||
* Map annotations with title and subtitle.
|
||||
*/
|
||||
annotations: React.PropTypes.arrayOf(React.PropTypes.shape({
|
||||
/**
|
||||
@ -192,7 +226,7 @@ const MapView = React.createClass({
|
||||
onBlur: React.PropTypes.func,
|
||||
|
||||
/**
|
||||
* Annotation title/subtile.
|
||||
* Annotation title and subtile.
|
||||
*/
|
||||
title: React.PropTypes.string,
|
||||
subtitle: React.PropTypes.string,
|
||||
@ -253,7 +287,6 @@ const MapView = React.createClass({
|
||||
|
||||
/**
|
||||
* Map overlays
|
||||
* @platform ios
|
||||
*/
|
||||
overlays: React.PropTypes.arrayOf(React.PropTypes.shape({
|
||||
/**
|
||||
@ -278,21 +311,17 @@ const MapView = React.createClass({
|
||||
})),
|
||||
|
||||
/**
|
||||
* Maximum size of area that can be displayed.
|
||||
* @platform ios
|
||||
* Maximum size of the area that can be displayed.
|
||||
*/
|
||||
maxDelta: React.PropTypes.number,
|
||||
|
||||
/**
|
||||
* Minimum size of area that can be displayed.
|
||||
* @platform ios
|
||||
* Minimum size of the area that can be displayed.
|
||||
*/
|
||||
minDelta: React.PropTypes.number,
|
||||
|
||||
/**
|
||||
* Insets for the map's legal label, originally at bottom left of the map.
|
||||
* See `EdgeInsetsPropType.js` for more information.
|
||||
* @platform ios
|
||||
*/
|
||||
legalLabelInsets: EdgeInsetsPropType,
|
||||
|
||||
@ -307,7 +336,7 @@ const MapView = React.createClass({
|
||||
onRegionChangeComplete: React.PropTypes.func,
|
||||
|
||||
/**
|
||||
* Deprecated. Use annotation onFocus and onBlur instead.
|
||||
* Deprecated. Use annotation `onFocus` and `onBlur` instead.
|
||||
*/
|
||||
onAnnotationPress: React.PropTypes.func,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user