Fixed MapView crash on iOS 8 and earlier

Summary: public

[MKPinAnnotationView redPinColor] is only supported on iOS 9 and later. This caused React Native to crash on iOS 8 and earlier.

This fixes the crash by providing a forked implementation for different OS versions.

Reviewed By: tadeuzagallo, javache

Differential Revision: D2702737

fb-gh-sync-id: cd8984f1f3d42989001f3c571e325f1b4ba09ac8
This commit is contained in:
Nick Lockwood
2015-11-30 05:07:43 -08:00
committed by facebook-github-bot-7
parent c9dd4015f1
commit c63de5e2a5
2 changed files with 60 additions and 6 deletions

View File

@@ -219,6 +219,10 @@ var MapView = React.createClass({
* The pin color. This can be any valid color string, or you can use one
* of the predefined PinColors constants. Applies to both standard pins
* and custom pin images.
*
* Note that on iOS 8 and earlier, only the standard PinColor constants
* are supported for regualr pins. For custom pin images, any tintColor
* value is supported on all iOS versions.
* @platform ios
*/
tintColor: React.PropTypes.string,
@@ -373,8 +377,10 @@ var MapView = React.createClass({
/**
* Standard iOS MapView pin color constants, to be used with the
* `annotation.tintColor` property. You are not obliged to use these,
* but they are useful for matching the standard iOS look and feel.
* `annotation.tintColor` property. On iOS 8 and earlier these are the
* only supported values when using regular pins. On iOS 9 and later
* you are not obliged to use these, but they are useful for matching
* the standard iOS look and feel.
*/
let PinColors = RCTMapConstants && RCTMapConstants.PinColors;
MapView.PinColors = PinColors && {