mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 19:44:13 +00:00
Fixed Flow errors
Reviewed By: nicklockwood Differential Revision: D2773940 fb-gh-sync-id: 3d632c57c411ddaf428c1d96d145da62dd115a14
This commit is contained in:
parent
57a76c0c01
commit
dc6ca95c3a
@ -33,19 +33,30 @@ var regionText = {
|
||||
longitudeDelta: '0',
|
||||
};
|
||||
|
||||
type MapRegion = {
|
||||
latitude: number,
|
||||
longitude: number,
|
||||
latitudeDelta?: number,
|
||||
longitudeDelta?: number,
|
||||
};
|
||||
|
||||
type MapRegionInputState = {
|
||||
region: MapRegion,
|
||||
};
|
||||
|
||||
var MapRegionInput = React.createClass({
|
||||
|
||||
propTypes: {
|
||||
region: React.PropTypes.shape({
|
||||
latitude: React.PropTypes.number.isRequired,
|
||||
longitude: React.PropTypes.number.isRequired,
|
||||
latitudeDelta: React.PropTypes.number.isRequired,
|
||||
longitudeDelta: React.PropTypes.number.isRequired,
|
||||
latitudeDelta: React.PropTypes.number,
|
||||
longitudeDelta: React.PropTypes.number,
|
||||
}),
|
||||
onChange: React.PropTypes.func.isRequired,
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
getInitialState(): MapRegionInputState {
|
||||
return {
|
||||
region: {
|
||||
latitude: 0,
|
||||
@ -93,7 +104,9 @@ var MapRegionInput = React.createClass({
|
||||
{'Latitude delta'}
|
||||
</Text>
|
||||
<TextInput
|
||||
value={'' + region.latitudeDelta}
|
||||
value={
|
||||
region.latitudeDelta == null ? '' : String(region.latitudeDelta)
|
||||
}
|
||||
style={styles.textInput}
|
||||
onChange={this._onChangeLatitudeDelta}
|
||||
selectTextOnFocus={true}
|
||||
@ -104,7 +117,9 @@ var MapRegionInput = React.createClass({
|
||||
{'Longitude delta'}
|
||||
</Text>
|
||||
<TextInput
|
||||
value={'' + region.longitudeDelta}
|
||||
value={
|
||||
region.longitudeDelta == null ? '' : String(region.longitudeDelta)
|
||||
}
|
||||
style={styles.textInput}
|
||||
onChange={this._onChangeLongitudeDelta}
|
||||
selectTextOnFocus={true}
|
||||
@ -149,9 +164,34 @@ 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?: number | string,
|
||||
image?: any,
|
||||
id?: string,
|
||||
view?: ReactElement,
|
||||
leftCalloutView?: ReactElement,
|
||||
rightCalloutView?: ReactElement,
|
||||
detailCalloutView?: ReactElement,
|
||||
}>;
|
||||
type MapViewExampleState = {
|
||||
isFirstLoad: boolean,
|
||||
mapRegion?: MapRegion,
|
||||
mapRegionInput?: MapRegion,
|
||||
annotations?: Annotations,
|
||||
};
|
||||
|
||||
var MapViewExample = React.createClass({
|
||||
|
||||
getInitialState() {
|
||||
getInitialState(): MapViewExampleState {
|
||||
return {
|
||||
isFirstLoad: true,
|
||||
};
|
||||
@ -175,7 +215,7 @@ var MapViewExample = React.createClass({
|
||||
);
|
||||
},
|
||||
|
||||
_getAnnotations(region) {
|
||||
_getAnnotations(region): Annotations {
|
||||
return [{
|
||||
longitude: region.longitude,
|
||||
latitude: region.latitude,
|
||||
@ -209,9 +249,14 @@ var MapViewExample = React.createClass({
|
||||
|
||||
});
|
||||
|
||||
type AnnotationExampleState = {
|
||||
isFirstLoad: boolean,
|
||||
annotations?: Annotations,
|
||||
mapRegion?: MapRegion,
|
||||
};
|
||||
var AnnotationExample = React.createClass({
|
||||
|
||||
getInitialState() {
|
||||
getInitialState(): AnnotationExampleState {
|
||||
return {
|
||||
isFirstLoad: true,
|
||||
};
|
||||
|
@ -26,12 +26,6 @@ const resolveAssetSource = require('resolveAssetSource');
|
||||
const requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
type Event = Object;
|
||||
type MapRegion = {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
latitudeDelta?: number;
|
||||
longitudeDelta?: number;
|
||||
};
|
||||
|
||||
const MapView = React.createClass({
|
||||
mixins: [NativeMethodsMixin],
|
||||
@ -155,14 +149,14 @@ const MapView = React.createClass({
|
||||
*/
|
||||
title: React.PropTypes.string,
|
||||
subtitle: React.PropTypes.string,
|
||||
|
||||
|
||||
/**
|
||||
* Callout views.
|
||||
*/
|
||||
leftCalloutView: React.PropTypes.element,
|
||||
rightCalloutView: React.PropTypes.element,
|
||||
detailCalloutView: React.PropTypes.element,
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
@ -191,7 +185,7 @@ const MapView = React.createClass({
|
||||
* annotation id
|
||||
*/
|
||||
id: React.PropTypes.string,
|
||||
|
||||
|
||||
/**
|
||||
* Deprecated. Use the left/right/detailsCalloutView props instead.
|
||||
*/
|
||||
@ -286,7 +280,7 @@ const MapView = React.createClass({
|
||||
rightCalloutView,
|
||||
detailCalloutView,
|
||||
} = annotation;
|
||||
|
||||
|
||||
if (!view && image && tintColor) {
|
||||
view = <Image
|
||||
style={{
|
||||
|
Loading…
x
Reference in New Issue
Block a user