diff --git a/index.d.ts b/index.d.ts index cac8420f60..5f9d7b3eeb 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,13 +1,14 @@ declare module "react-native-maps" { import * as React from 'react'; - + import { Animated } from 'react-native'; + export interface Region { latitude: number longitude: number latitudeDelta: number longitudeDelta: number } - + export interface LatLng { latitude: number longitude: number @@ -18,6 +19,27 @@ declare module "react-native-maps" { y: number } + export class AnimatedRegion extends Animated.AnimatedWithChildren { + latitude: Animated.Value + longitude: Animated.Value + latitudeDelta: Animated.Value + longitudeDelta: Animated.Value + + constructor(LatLng); + + setValue(value: Region): void; + setOffset(offset: Region): void; + flattenOffset(): void; + __getValue(): Region; + __attach(): void; + __detach(): void; + stopAnimation(callback?: Function): void; + addListener(callback: Function): string; + removeListener(id: string): void; + spring(config: any): any; + timing(config: any): any; + } + export interface MapViewProps { provider?: 'google'; style: any; @@ -72,8 +94,17 @@ declare module "react-native-maps" { } export default class MapView extends React.Component { - static Animated: any; - static AnimatedRegion: any; + animateToRegion(region: Region, duration?: number): void; + animateToCoordinate(latLng: LatLng, duration?: number): void; + animateToBearing(bearing: number, duration?: number): void; + animateToViewingAngle(angle: number, duration?: number): void; + fitToElements(animated: boolean): void; + fitToSuppliedMarkers(markers: string[], animated: boolean): void; + fitToCoordinates(coordinates?: LatLng[], options?:{}): void; + setMapBoundaries(northEast: LatLng, southWest: LatLng): void; + } + + export class MapViewAnimated extends React.Component { animateToRegion(region: Region, duration?: number): void; animateToCoordinate(latLng: LatLng, duration?: number): void; animateToBearing(bearing: number, duration?: number): void; @@ -95,7 +126,7 @@ declare module "react-native-maps" { image?: any; opacity?: number; pinColor?: string; - coordinate: { latitude: number; longitude: number }; + coordinate: { latitude: number; longitude: number } | AnimatedRegion; centerOffset?: { x: number; y: number }; calloutOffset?: { x: number; y: number }; anchor?: { x: number; y: number }; @@ -175,6 +206,11 @@ declare module "react-native-maps" { zIndex?: number; } + export interface MapOverlayProps { + image?: any; + bounds: LatLng[]; + } + export interface MapCalloutProps { tooltip?: boolean; onPress?: Function; @@ -191,5 +227,13 @@ declare module "react-native-maps" { export class Circle extends React.Component { } export class UrlTile extends React.Component { } export class LocalTile extends React.Component { } + export class Overlay extends React.Component { } export class Callout extends React.Component { } + + export class MarkerAnimated extends React.Component { + showCallout(): void; + hideCallout(): void; + animateMarkerToCoordinate(coordinate: LatLng, duration: number): void; + } + export class OverlayAnimated extends React.Component { } } diff --git a/index.js b/index.js index 5574621292..c89dd5b92f 100644 --- a/index.js +++ b/index.js @@ -1,16 +1,23 @@ import MapView from './lib/components/MapView'; +import Marker from './lib/components/MapMarker.js'; +import Overlay from './lib/components/MapOverlay.js'; -export { default as Marker } from './lib/components/MapMarker.js'; export { default as Polyline } from './lib/components/MapPolyline.js'; export { default as Polygon } from './lib/components/MapPolygon.js'; export { default as Circle } from './lib/components/MapCircle.js'; export { default as UrlTile } from './lib/components/MapUrlTile.js'; export { default as LocalTile } from './lib/components/MapLocalTile.js'; -export { default as Overlay } from './lib/components/MapOverlay.js'; export { default as Callout } from './lib/components/MapCallout.js'; export { default as AnimatedRegion } from './lib/components/AnimatedRegion.js'; export { Animated, ProviderPropType, MAP_TYPES } from './lib/components/MapView.js'; + +export { Marker, Overlay }; + export const PROVIDER_GOOGLE = MapView.PROVIDER_GOOGLE; export const PROVIDER_DEFAULT = MapView.PROVIDER_DEFAULT; +export const MarkerAnimated = Marker.Animated; +export const OverlayAnimated = Overlay.Animated; + export default MapView; +