Skip to content

Commit

Permalink
feat(MapView): remove redundant static members
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Components are no longer available as static members of
MapView. They must now be imported explicitly if used.
  • Loading branch information
monholm committed Oct 4, 2021
1 parent f3cc5f6 commit c718c99
Showing 1 changed file with 2 additions and 45 deletions.
47 changes: 2 additions & 45 deletions src/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,7 @@ import {
NativeSyntheticEvent,
LayoutChangeEvent,
} from 'react-native';
import MapMarker from './MapMarker';
import MapPolyline from './MapPolyline';
import MapPolygon from './MapPolygon';
import MapCircle from './MapCircle';
import MapCallout from './MapCallout';
import MapCalloutSubview from './MapCalloutSubview';
import MapOverlay from './MapOverlay';
import MapUrlTile from './MapUrlTile';
import MapWMSTile from './MapWMSTile';
import MapLocalTile from './MapLocalTile';
import MapHeatMap from './MapHeatmap';
import AnimatedRegion from './AnimatedRegion';
import Geojson from './Geojson';
import {
contextTypes as childContextTypes,
getAirMapName,
googleMapIsInstalled,
createNotSupportedComponent,
Expand Down Expand Up @@ -171,6 +157,8 @@ export type NativeCommandName =
| 'getMarkersFrames';

class MapView extends React.Component<Props, State, SnapShot> {
static viewConfig = viewConfig;

private map: any; // todo: narrow down type
private __lastRegion: Region | undefined;
private __layoutCalled: boolean | undefined;
Expand Down Expand Up @@ -651,11 +639,6 @@ class MapView extends React.Component<Props, State, SnapShot> {
}
}

MapView.viewConfig = viewConfig;
MapView.childContextTypes = childContextTypes;

MapView.MAP_TYPES = MAP_TYPES;

//todo: narrow down types
const airMaps: any = {
default: requireNativeComponent('AIRMap'),
Expand Down Expand Up @@ -687,30 +670,4 @@ if (!NativeModules.UIManager.getViewManagerConfig) {

export const Animated = RNAnimated.createAnimatedComponent(MapView);

/**
* TODO:
* All of these properties on MapView are unecessary since they can be imported
* individually with the es6 exports in index.js. Removing them is a breaking change,
* but potentially allows for better dead code elimination since references are not
* kept to components which are never used.
*/

MapView.Marker = MapMarker;
MapView.Polyline = MapPolyline;
MapView.Polygon = MapPolygon;
MapView.Circle = MapCircle;
MapView.UrlTile = MapUrlTile;
MapView.MapWMSTile = MapWMSTile;
MapView.LocalTile = MapLocalTile;
MapView.Heatmap = MapHeatMap;
MapView.Overlay = MapOverlay;
MapView.Callout = MapCallout;
MapView.CalloutSubview = MapCalloutSubview;
Object.assign(MapView, ProviderConstants);

MapView.Animated = Animated;
MapView.AnimatedRegion = AnimatedRegion;

MapView.Geojson = Geojson;

export default MapView;

0 comments on commit c718c99

Please sign in to comment.