Permalink
Browse files

Deprecate MapView in favor of airbnb/react-native-maps

Summary:
Compared to the `<MapView>` that comes with React Native, [react-native-maps](https://github.com/airbnb/react-native-maps) work on Android and is more feature complete. It is actively maintained and used extensively (9.2k installs / month, see [JS.Coach](https://js.coach/react-native/react-native-maps?search=react-native-maps)).

We think now is a good time to switch to react-native-maps in your applications and make `react-native-maps` the official `<MapView>` implementation for React Native.

We are going to release the deprecated `<MapView>` as a separate npm module so you can migrate to `react-native-maps` at your own pace.

**Test Plan**

Checked the docs render correctly on the website:

```
cd website
npm install
npm start
```

<img width="696" alt="screenshot 2016-11-01 20 17 31" src="https://cloud.githubusercontent.com/assets/346214/19905831/480074b8-a070-11e6-8779-8e12343c2883.png">

Warning is shown:

<img width="423" alt="screenshot 2016-11-01 20 39 21" src="https://cloud.githu
Closes #10500

Differential Revision: D4119602

Pulled By: mkonicek

fbshipit-source-id: 86780a98bf999e6047565ab66a5ebbd15e499a46
  • Loading branch information...
1 parent 07fb904 commit dca53feb4fc156a42b834d94beb30811325b031f @mkonicek mkonicek committed with Facebook Github Bot Nov 3, 2016
Showing with 23 additions and 6 deletions.
  1. +23 −6 Libraries/Components/MapView/MapView.js
@@ -27,7 +27,7 @@ const requireNativeComponent = require('requireNativeComponent');
type Event = Object;
/**
- * State an annotation on the map.
+ * State of an annotation on the map.
*/
export type AnnotationDragState = $Enum<{
/**
@@ -53,15 +53,19 @@ export type AnnotationDragState = $Enum<{
}>;
/**
- * **This component is only supported on iOS.**
+ * **IMPORTANT: This component is now DEPRECATED and will be removed
+ * in January 2017 (React Native version 0.42). This component only supports
+ * iOS.**
+ *
+ * **Please use
+ * [react-native-maps](https://github.com/airbnb/react-native-maps) by Airbnb
+ * instead of this component.** Our friends at Airbnb have done an amazing job
+ * building a cross-platform `MapView` component that is more feature
+ * complete. It is used extensively (over 9k installs / month).
*
* `MapView` is used to display embeddable maps and annotations using
* `MKMapView`.
*
- * For a cross-platform solution, check out
- * [react-native-maps](https://github.com/airbnb/react-native-maps)
- * by Airbnb.
- *
* ```
* import React, { Component } from 'react';
* import { MapView } from 'react-native';
@@ -82,6 +86,19 @@ export type AnnotationDragState = $Enum<{
const MapView = React.createClass({
+ componentWillMount: function() {
+ console.warn(
+ 'MapView is now deprecated and will be removed from React Native in version 0.42. ' +
+ 'Please use the react-native-maps module which is more feature complete ' +
+ 'and works on Android too: https://github.com/airbnb/react-native-maps\n' +
+ 'It is actively maintained and used extensively.\n\n' +
+ 'Once MapView is removed from React Native in v0.42, we will release the ' +
+ 'code as deprecated-react-native-ios-mapview. You will be able to ' +
+ 'continue using that and migrate to react-native-maps your own pace later.\n\n' +
+ 'For more info, check out https://github.com/facebook/react-native/pull/10500'
+ );
+ },
+
mixins: [NativeMethodsMixin],
propTypes: {

1 comment on commit dca53fe

@akshaysmurthy

👍

Please sign in to comment.