react-native-maps 2.0.0-beta.6 → 2.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/MapView.d.ts CHANGED
@@ -581,11 +581,11 @@ declare class MapView extends React.Component<MapViewProps, State> {
581
581
  private _onChange;
582
582
  getCamera(): Promise<Camera>;
583
583
  setCamera(camera: Partial<Camera>): void;
584
- animateCamera(camera: Partial<Camera>, duration?: number): void;
585
- animateToRegion(region: Region, duration?: number): void;
586
- fitToElements(options?: FitToOptions): void;
587
- fitToSuppliedMarkers(markers: string[], options?: FitToOptions): void;
588
- fitToCoordinates(coordinates?: LatLng[], options?: FitToOptions): void;
584
+ animateCamera(camera: Partial<Camera>, duration?: number): Promise<void>;
585
+ animateToRegion(region: Region, duration?: number): Promise<void>;
586
+ fitToElements(options?: FitToOptions): Promise<void>;
587
+ fitToSuppliedMarkers(markers: string[], options?: FitToOptions): Promise<void>;
588
+ fitToCoordinates(coordinates?: LatLng[], options?: FitToOptions): Promise<void>;
589
589
  /**
590
590
  * Get visible boudaries
591
591
  *
package/lib/MapView.js CHANGED
@@ -95,32 +95,37 @@ class MapView extends React.Component {
95
95
  }
96
96
  }
97
97
  animateCamera(camera, duration = 500) {
98
- if (this.map.current) {
99
- MapViewNativeComponent_1.Commands.animateCamera(this.map.current, camera, duration);
98
+ if (this._gogleMapsOniOS()) {
99
+ return googleMapViewModuleMethod('animateCamera')(this._getHandle(), camera, duration);
100
100
  }
101
+ return mapViewModuleMethod('animateCamera')(this._getHandle(), camera, duration);
101
102
  }
102
103
  animateToRegion(region, duration = 500) {
103
- if (this.map.current) {
104
- MapViewNativeComponent_1.Commands.animateToRegion(this.map.current, region, duration);
104
+ if (this._gogleMapsOniOS()) {
105
+ return googleMapViewModuleMethod('animateToRegion')(this._getHandle(), region, duration);
105
106
  }
107
+ return mapViewModuleMethod('animateToRegion')(this._getHandle(), region, duration);
106
108
  }
107
109
  fitToElements(options = {}) {
108
- if (this.map.current) {
109
- const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
110
- MapViewNativeComponent_1.Commands.fitToElements(this.map.current, edgePadding, animated);
110
+ const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, duration = 0 } = options;
111
+ if (this._gogleMapsOniOS()) {
112
+ return googleMapViewModuleMethod('fitToElements')(this._getHandle(), edgePadding, duration);
111
113
  }
114
+ return mapViewModuleMethod('fitToElements')(this._getHandle(), edgePadding, duration);
112
115
  }
113
116
  fitToSuppliedMarkers(markers, options = {}) {
114
- if (this.map.current) {
115
- const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
116
- MapViewNativeComponent_1.Commands.fitToSuppliedMarkers(this.map.current, markers, edgePadding, animated);
117
+ const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, duration = 0 } = options;
118
+ if (this._gogleMapsOniOS()) {
119
+ return googleMapViewModuleMethod('fitToSuppliedMarkers')(this._getHandle(), markers, edgePadding, duration);
117
120
  }
121
+ return mapViewModuleMethod('fitToSuppliedMarkers')(this._getHandle(), markers, edgePadding, duration);
118
122
  }
119
123
  fitToCoordinates(coordinates = [], options = {}) {
120
- if (this.map.current) {
121
- const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
122
- MapViewNativeComponent_1.Commands.fitToCoordinates(this.map.current, coordinates, edgePadding, animated);
124
+ const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, duration = 0 } = options;
125
+ if (this._gogleMapsOniOS()) {
126
+ return googleMapViewModuleMethod('fitToCoordinates')(this._getHandle(), coordinates, edgePadding, duration);
123
127
  }
128
+ return mapViewModuleMethod('fitToCoordinates')(this._getHandle(), coordinates, edgePadding, duration);
124
129
  }
125
130
  /**
126
131
  * Get visible boudaries
@@ -119,7 +119,7 @@ export type ChangeEvent = NativeSyntheticEvent<{
119
119
  }>;
120
120
  export type FitToOptions = {
121
121
  edgePadding?: EdgePadding;
122
- animated?: boolean;
122
+ duration?: number;
123
123
  };
124
124
  export type BoundingBox = {
125
125
  northEast: LatLng;
@@ -1,16 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import type { HostComponent } from 'react-native';
3
3
  import { NativeProps } from './MapView';
4
- import { Camera, EdgePadding } from './MapView.types';
5
- import { LatLng, Region } from './sharedTypes';
4
+ import { Camera } from './MapView.types';
5
+ import { LatLng } from './sharedTypes';
6
6
  export type MapViewNativeComponentType = HostComponent<NativeProps>;
7
7
  interface NativeCommands {
8
- animateToRegion: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, region: Region, duration: number) => void;
9
8
  setCamera: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, camera: Partial<Camera>) => void;
10
- animateCamera: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, camera: Partial<Camera>, duration: number) => void;
11
- fitToElements: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, edgePadding: EdgePadding, animated: boolean) => void;
12
- fitToSuppliedMarkers: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, markers: string[], edgePadding: EdgePadding, animated: boolean) => void;
13
- fitToCoordinates: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, coordinates: LatLng[], edgePadding: EdgePadding, animated: boolean) => void;
14
9
  setMapBoundaries: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, northEast: LatLng, southWest: LatLng) => void;
15
10
  setIndoorActiveLevelIndex: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, activeLevelIndex: number) => void;
16
11
  }
@@ -7,12 +7,7 @@ exports.Commands = void 0;
7
7
  const codegenNativeCommands_1 = __importDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));
8
8
  exports.Commands = (0, codegenNativeCommands_1.default)({
9
9
  supportedCommands: [
10
- 'animateToRegion',
11
10
  'setCamera',
12
- 'animateCamera',
13
- 'fitToElements',
14
- 'fitToSuppliedMarkers',
15
- 'fitToCoordinates',
16
11
  'setMapBoundaries',
17
12
  'setIndoorActiveLevelIndex',
18
13
  ],
@@ -1,8 +1,13 @@
1
1
  import type { TurboModule } from 'react-native';
2
- import { BoundingBox, Camera, MarkersFrames } from './MapView.types';
2
+ import { BoundingBox, Camera, EdgePadding, MarkersFrames } from './MapView.types';
3
3
  import { LatLng, Point, Region } from './sharedTypes';
4
4
  export interface Spec extends TurboModule {
5
+ animateCamera: (viewTag: number, camera: Partial<Camera>, duration: number) => Promise<void>;
6
+ animateToRegion: (viewTag: number, region: Region, duration: number) => Promise<void>;
5
7
  coordinateForPoint: (viewTag: number, point: Point) => Promise<LatLng>;
8
+ fitToCoordinates: (viewTag: number, coordinates: LatLng[], edgePadding: EdgePadding, duration: number) => Promise<void>;
9
+ fitToElements: (viewTag: number, edgePadding: EdgePadding, duration: number) => Promise<void>;
10
+ fitToSuppliedMarkers: (viewTag: number, markers: string[], edgePadding: EdgePadding, duration: number) => Promise<void>;
6
11
  getCamera: (viewTag: number) => Promise<Camera>;
7
12
  getMapBoundaries: (viewTag: number) => Promise<BoundingBox>;
8
13
  getMarkersFrames: (viewTag: number, onlyVisible: boolean) => Promise<MarkersFrames>;
@@ -1,10 +1,15 @@
1
1
  import type { TurboModule } from 'react-native';
2
- import { Address, BoundingBox, Camera, MarkersFrames } from './MapView.types';
2
+ import { Address, BoundingBox, Camera, EdgePadding, MarkersFrames } from './MapView.types';
3
3
  import { LatLng, Point, Region } from './sharedTypes';
4
4
  export interface Spec extends TurboModule {
5
+ animateCamera: (viewTag: number, camera: Partial<Camera>, duration: number) => Promise<void>;
6
+ animateToRegion: (viewTag: number, region: Region, duration: number) => Promise<void>;
5
7
  coordinateForPoint: (viewTag: number, point: Point) => Promise<LatLng>;
6
8
  /** android only */
7
9
  enableLatestRenderer: () => Promise<string>;
10
+ fitToCoordinates: (viewTag: number, coordinates: LatLng[], edgePadding: EdgePadding, duration: number) => Promise<void>;
11
+ fitToElements: (viewTag: number, edgePadding: EdgePadding, duration: number) => Promise<void>;
12
+ fitToSuppliedMarkers: (viewTag: number, markers: string[], edgePadding: EdgePadding, duration: number) => Promise<void>;
8
13
  getAddressFromCoordinates: (viewTag: number, coordinate: LatLng) => Promise<Address>;
9
14
  getCamera: (viewTag: number) => Promise<Camera>;
10
15
  getMapBoundaries: (viewTag: number) => Promise<BoundingBox>;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "main": "lib/index.js",
6
6
  "author": "Leland Richardson <leland.m.richardson@gmail.com>",
7
7
  "homepage": "https://github.com/react-native-maps/react-native-maps#readme",
8
- "version": "2.0.0-beta.6",
8
+ "version": "2.0.0-beta.8",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",