Removed overly-strict typing in MapViewExample
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
This commit is contained in:
parent
18d2177989
commit
ba3a5f0eec
|
@ -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: {
|
||||
|
@ -56,7 +45,7 @@ var MapRegionInput = React.createClass({
|
|||
onChange: React.PropTypes.func.isRequired,
|
||||
},
|
||||
|
||||
getInitialState(): MapRegionInputState {
|
||||
getInitialState() {
|
||||
return {
|
||||
region: {
|
||||
latitude: 0,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -207,7 +175,7 @@ var MapViewExample = React.createClass({
|
|||
);
|
||||
},
|
||||
|
||||
_getAnnotations(region): Annotations {
|
||||
_getAnnotations(region) {
|
||||
return [{
|
||||
longitude: region.longitude,
|
||||
latitude: region.latitude,
|
||||
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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({
|
||||
|
|
Loading…
Reference in New Issue