Skip to content

Commit

Permalink
Removed overly-strict typing in MapViewExample
Browse files Browse the repository at this point in the history
Summary:
public

While it's nice to see such a masterclass in strict typing with Flow, having it an example serves no useful purpose, and makes the example unnecessarily fragile with respect to API changes.

Reviewed By: gabelevi

Differential Revision: D2769981

fb-gh-sync-id: db5550d5674bf32ef8d331861751a4e6aa1f6536
  • Loading branch information
nicklockwood authored and facebook-github-bot-3 committed Dec 18, 2015
1 parent 18d2177 commit ba3a5f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 43 deletions.
45 changes: 4 additions & 41 deletions Examples/UIExplorer/MapViewExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@ var regionText = {
longitudeDelta: '0',
};

type MapRegion = {
latitude: number,
longitude: number,
latitudeDelta: number,
longitudeDelta: number,
};

type MapRegionInputState = {
region: MapRegion,
};

var MapRegionInput = React.createClass({

propTypes: {
Expand All @@ -56,7 +45,7 @@ var MapRegionInput = React.createClass({
onChange: React.PropTypes.func.isRequired,
},

getInitialState(): MapRegionInputState {
getInitialState() {
return {
region: {
latitude: 0,
Expand Down Expand Up @@ -160,30 +149,9 @@ var MapRegionInput = React.createClass({

});

type Annotations = Array<{
animateDrop?: boolean,
latitude: number,
longitude: number,
title?: string,
subtitle?: string,
hasLeftCallout?: boolean,
hasRightCallout?: boolean,
onLeftCalloutPress?: Function,
onRightCalloutPress?: Function,
tintColor?: string,
image?: any,
id?: string,
}>;
type MapViewExampleState = {
isFirstLoad: boolean,
mapRegion?: MapRegion,
mapRegionInput?: MapRegion,
annotations?: Annotations,
};

var MapViewExample = React.createClass({

getInitialState(): MapViewExampleState {
getInitialState() {
return {
isFirstLoad: true,
};
Expand All @@ -207,7 +175,7 @@ var MapViewExample = React.createClass({
);
},

_getAnnotations(region): Annotations {
_getAnnotations(region) {
return [{
longitude: region.longitude,
latitude: region.latitude,
Expand Down Expand Up @@ -241,14 +209,9 @@ var MapViewExample = React.createClass({

});

type AnnotationExampleState = {
isFirstLoad: boolean,
annotations?: Annotations,
mapRegion?: MapRegion,
};
var AnnotationExample = React.createClass({

getInitialState(): AnnotationExampleState {
getInitialState() {
return {
isFirstLoad: true,
};
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/MapView/MapView.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ type Event = Object;
type MapRegion = {
latitude: number;
longitude: number;
latitudeDelta?: ?number;
longitudeDelta?: ?number;
latitudeDelta?: number;
longitudeDelta?: number;
};

const MapView = React.createClass({
Expand Down

0 comments on commit ba3a5f0

Please sign in to comment.