Add tests

This commit is contained in:
Jan Aagaard
2018-12-01 14:12:37 +01:00
parent d329f5f969
commit 1b01b4ccbf

View File

@@ -43,6 +43,16 @@ import {
Updates
} from 'expo';
import {
EdgeInsets,
EdgePadding,
EventUserLocation,
KmlMapEvent,
MapEvent,
MapStyleElement,
Region
} from './MapView';
const reverseGeocode: Promise<Location.GeocodeData[]> = Location.reverseGeocodeAsync({
latitude: 0,
longitude: 0
@@ -837,15 +847,95 @@ async () => {
};
// #region MapView
const initialRegion: Region = {
latitude: 0,
longitude: 0,
latitudeDelta: 0,
longitudeDelta: 0,
};
const edgePadding: EdgePadding = {
top: 0,
right: 0,
bottom: 0,
left: 0,
};
const edgeInsets: EdgeInsets = {
top: 0,
right: 0,
bottom: 0,
left: 0,
};
const mapStyleElements: MapStyleElement[] = [{
featureType: 'featureType',
elementType: 'elementType',
stylers: [{}, {}],
}];
const mapEventCallback = (event: MapEvent) => console.log(event);
const regionCallback = (region: Region) => console.log(region);
const kmlCallback = (kml: KmlMapEvent) => console.log(kml);
const userLocationCallback = (event: EventUserLocation) => console.log(event);
() => (
<MapView
provider="google"
customMapStyle={mapStyleElements}
customMapStyleString="some-string"
showsUserLocation={true}
userLocationAnnotationTitle="title"
showsMyLocationButton={true}
followsUserLocation={true}
showsPointsOfInterest={true}
showsCompass={true}
zoomEnabled={true}
zoomControlEnabled={true}
rotateEnabled={true}
cacheEnabled={true}
loadingEnabled={true}
loadingBackgroundColor="#000"
loadingIndicatorColor="#000"
scrollEnabled={true}
pitchEnabled={true}
toolbarEnabled={true}
moveOnMarkerPress={true}
showsScale={true}
showsBuildings={true}
showsTraffic={true}
showsIndoors={true}
showsIndoorLevelPicker={true}
mapType="standard"
region={initialRegion}
initialRegion={initialRegion}
liteMode={true}
mapPadding={edgePadding}
maxDelta={0}
minDelta={0}
legalLabelInsets={edgeInsets}
onMapReady={() => ({})}
onKmlReady={kmlCallback}
onRegionChange={regionCallback}
onRegionChangeComplete={regionCallback}
onPress={mapEventCallback}
onLongPress={mapEventCallback}
onUserLocationChange={userLocationCallback}
onPanDrag={mapEventCallback}
onPoiClick={(event: MapEvent<{ placeId: string, name: string }>) => console.log(event)}
onMarkerPress={(event: MapEvent<{ action: 'marker-press', id: string }>) => console.log(event)}
onMarkerSelect={(event: MapEvent<{ action: 'marker-select', id: string }>) => console.log(event)}
onMarkerDeselect={(event: MapEvent<{ action: 'marker-deselect', id: string }>) => console.log(event)}
onCalloutPress={(event: MapEvent<{ action: 'callout-press' }>) => console.log(event)}
onMarkerDragStart={mapEventCallback}
onMarkerDrag={mapEventCallback}
onMarkerDragEnd={mapEventCallback}
minZoomLevel={0}
maxZoomLevel={0}
kmlSrc="src"
style={{ flex: 1 }}
initialRegion={{
latitude: 55.6838499,
latitudeDelta: 0.1,
longitude: 12.5630238,
longitudeDelta: 0.1
}}
/>
);
// #endegion