Skip to content

Commit

Permalink
fix: prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrauber committed Jul 15, 2024
1 parent b787bc7 commit 56e5544
Show file tree
Hide file tree
Showing 67 changed files with 1,152 additions and 1,127 deletions.
7 changes: 0 additions & 7 deletions .eslintrc.js

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc.js

This file was deleted.

6 changes: 3 additions & 3 deletions example/src/assets/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
declare module '*.jpg' {
declare module "*.jpg" {
const content: number;
export default content;
}

declare module '*.png' {
declare module "*.png" {
const content: number;
export default content;
}

declare module '*.json' {
declare module "*.json" {
const content: string;
export default content;
}
48 changes: 25 additions & 23 deletions example/src/examples/Annotations/CustomCallout.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import MapLibreGL, {SymbolLayerStyle} from '@maplibre/maplibre-react-native';
import {Feature} from '@turf/helpers/dist/js';
import React, {FC, useState, ReactElement} from 'react';
import {View, Text, ViewStyle, StyleProp, TextStyle} from 'react-native';
import MapLibreGL, { SymbolLayerStyle } from "@maplibre/maplibre-react-native";
import { Feature } from "@turf/helpers/dist/js";
import React, { FC, useState, ReactElement } from "react";
import { View, Text, ViewStyle, StyleProp, TextStyle } from "react-native";

import exampleIcon from '../../assets/pin.png';
import sheet from '../../styles/sheet';
import Page from '../common/Page';
import exampleIcon from "../../assets/pin.png";
import sheet from "../../styles/sheet";
import Page from "../common/Page";

const defaultCamera = {
centerCoordinate: [12.338, 45.4385],
zoomLevel: 17.4,
};

const featureCollection: GeoJSON.FeatureCollection = {
type: 'FeatureCollection',
type: "FeatureCollection",
features: [
{
type: 'Feature',
id: '9d10456e-bdda-4aa9-9269-04c1667d4552',
type: "Feature",
id: "9d10456e-bdda-4aa9-9269-04c1667d4552",
properties: {
icon: 'example',
message: 'Hello!',
icon: "example",
message: "Hello!",
},
geometry: {
type: 'Point',
type: "Point",
coordinates: [12.338, 45.4385],
},
},
Expand All @@ -34,7 +34,7 @@ type CustomCalloutViewProps = {
message: string;
};

const CustomCalloutView: FC<CustomCalloutViewProps> = ({message}) => {
const CustomCalloutView: FC<CustomCalloutViewProps> = ({ message }) => {
return (
<View style={styles.calloutContainerStyle}>
<Text style={styles.customCalloutText}>{message}</Text>
Expand All @@ -48,7 +48,7 @@ type CustomCalloutProps = {

const CustomCallout = (props: CustomCalloutProps): ReactElement => {
const [selectedFeature, setSelectedFeature] =
useState<Feature<{type: string; coordinates: number[]}>>();
useState<Feature<{ type: string; coordinates: number[] }>>();

const onPinPress = (e: any): void => {
if (selectedFeature) {
Expand All @@ -67,7 +67,8 @@ const CustomCallout = (props: CustomCalloutProps): ReactElement => {
<MapLibreGL.ShapeSource
id="mapPinsSource"
shape={featureCollection}
onPress={onPinPress}>
onPress={onPinPress}
>
<MapLibreGL.SymbolLayer
id="mapPinsLayer"
style={styles.mapPinLayer}
Expand All @@ -76,7 +77,8 @@ const CustomCallout = (props: CustomCalloutProps): ReactElement => {
{selectedFeature && (
<MapLibreGL.MarkerView
id="selectedFeatureMarkerView"
coordinate={selectedFeature.geometry.coordinates}>
coordinate={selectedFeature.geometry.coordinates}
>
<CustomCalloutView message={selectedFeature?.properties?.message} />
</MapLibreGL.MarkerView>
)}
Expand All @@ -94,21 +96,21 @@ interface CustomCalloutStyles {
const styles: CustomCalloutStyles = {
mapPinLayer: {
iconAllowOverlap: true,
iconAnchor: 'bottom',
iconAnchor: "bottom",
iconSize: 1.0,
iconImage: exampleIcon,
},
customCalloutText: {
color: 'black',
color: "black",
fontSize: 16,
},
calloutContainerStyle: {
backgroundColor: 'white',
backgroundColor: "white",
width: 60,
height: 40,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
display: "flex",
justifyContent: "center",
alignItems: "center",
},
};

Expand Down
23 changes: 12 additions & 11 deletions example/src/examples/Map/ShowMap.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import MapLibreGL from '@maplibre/maplibre-react-native';
import React, {useState, useEffect, ReactElement} from 'react';
import {Alert} from 'react-native';
import MapLibreGL from "@maplibre/maplibre-react-native";
import React, { useState, useEffect, ReactElement } from "react";
import { Alert } from "react-native";

import sheet from '../../styles/sheet';
import {onSortOptions} from '../../utils';
import TabBarPage from '../common/TabBarPage';
import sheet from "../../styles/sheet";
import { onSortOptions } from "../../utils";
import TabBarPage from "../common/TabBarPage";

const ShowMap = (): ReactElement => {
const _mapOptions = Object.keys(MapLibreGL.StyleURL)
.map(key => {
.map((key) => {
return {
label: key,
data: (MapLibreGL.StyleURL as any)[key], // bad any, because enums
};
})
.sort(onSortOptions);

const [styleURL, setStyleURL] = useState({styleURL: _mapOptions[0].data});
const [styleURL, setStyleURL] = useState({ styleURL: _mapOptions[0].data });

useEffect(() => {
MapLibreGL.locationManager.start();
Expand All @@ -30,18 +30,19 @@ const ShowMap = (): ReactElement => {
index: number,
newStyleURL: MapLibreGL.StyleURL,
): void => {
setStyleURL({styleURL: newStyleURL});
setStyleURL({ styleURL: newStyleURL });
};

const onUserMarkerPress = (): void => {
Alert.alert('You pressed on the user location annotation');
Alert.alert("You pressed on the user location annotation");
};

return (
<TabBarPage scrollable options={_mapOptions} onOptionPress={onMapChange}>
<MapLibreGL.MapView
styleURL={styleURL.styleURL}
style={sheet.matchParent}>
style={sheet.matchParent}
>
<MapLibreGL.Camera followZoomLevel={6} followUserLocation />

<MapLibreGL.UserLocation onPress={onUserMarkerPress} />
Expand Down
16 changes: 8 additions & 8 deletions example/src/examples/Map/ShowMapLocalStyle.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import MapLibreGL from '@maplibre/maplibre-react-native';
import React, {FC, useEffect} from 'react';
import {Alert} from 'react-native';
import MapLibreGL from "@maplibre/maplibre-react-native";
import React, { FC, useEffect } from "react";
import { Alert } from "react-native";

import sheet from '../../styles/sheet';
import Page from '../common/Page';
import sheet from "../../styles/sheet";
import Page from "../common/Page";

// eslint-disable-next-line @typescript-eslint/no-var-requires
const style = JSON.stringify(require('../../assets/map-styleURL-style.json'));
const style = JSON.stringify(require("../../assets/map-styleURL-style.json"));

const ShowMap: FC<any> = props => {
const ShowMap: FC<any> = (props) => {
useEffect(() => {
MapLibreGL.locationManager.start();

Expand All @@ -18,7 +18,7 @@ const ShowMap: FC<any> = props => {
}, []);

const onUserMarkerPress = (): void => {
Alert.alert('You pressed on the user location annotation');
Alert.alert("You pressed on the user location annotation");
};

return (
Expand Down
14 changes: 7 additions & 7 deletions example/src/examples/common/Page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {useNavigation, useRoute} from '@react-navigation/native';
import React, {ReactElement} from 'react';
import {View} from 'react-native';
import { useNavigation, useRoute } from "@react-navigation/native";
import React, { ReactElement } from "react";
import { View } from "react-native";

import MapHeader from './MapHeader';
import colors from '../../styles/colors';
import sheet from '../../styles/sheet';
import MapHeader from "./MapHeader";
import colors from "../../styles/colors";
import sheet from "../../styles/sheet";

interface PageProps {
children: ReactElement | ReactElement[];
}

const Page = ({children}: PageProps): ReactElement => {
const Page = ({ children }: PageProps): ReactElement => {
const navigation = useNavigation();
const route = useRoute();
const label = route.name;
Expand Down
2 changes: 1 addition & 1 deletion javascript/@types/assets.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare module '*.png' {
declare module "*.png" {
const content: number;
export default content;
}
4 changes: 2 additions & 2 deletions javascript/MLNModule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {NativeModules} from 'react-native';
import { NativeModules } from "react-native";

interface IMLNModule {
StyleURL: {
Expand All @@ -24,7 +24,7 @@ interface IMLNModule {
setConnected(connected: boolean): void;
}

const MLNModule: IMLNModule = {...NativeModules.MLNModule};
const MLNModule: IMLNModule = { ...NativeModules.MLNModule };

export const {
StyleURL,
Expand Down
72 changes: 36 additions & 36 deletions javascript/Maplibre.ts
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
import {UserTrackingMode} from './components/Camera';
import { UserTrackingMode } from "./components/Camera";

export * from './MLNModule';
export * from "./MLNModule";
export {
default as Camera,
UserTrackingMode,
type CameraPadding,
type CameraAnimationMode,
type CameraBounds,
type CameraRef,
} from './components/Camera';
export {default as MapView, type MapViewRef} from './components/MapView';
export {default as Light} from './components/Light';
export {default as PointAnnotation} from './components/PointAnnotation';
export type {PointAnnotationRef} from './components/PointAnnotation';
export {default as Annotation} from './components/annotations/Annotation';
export {default as Callout} from './components/Callout';
export {requestAndroidLocationPermissions} from './requestAndroidLocationPermissions';
} from "./components/Camera";
export { default as MapView, type MapViewRef } from "./components/MapView";
export { default as Light } from "./components/Light";
export { default as PointAnnotation } from "./components/PointAnnotation";
export type { PointAnnotationRef } from "./components/PointAnnotation";
export { default as Annotation } from "./components/annotations/Annotation";
export { default as Callout } from "./components/Callout";
export { requestAndroidLocationPermissions } from "./requestAndroidLocationPermissions";
export {
default as UserLocation,
UserLocationRenderMode,
} from './components/UserLocation';
export type {UserLocationRef} from './components/UserLocation';
export {default as VectorSource} from './components/VectorSource';
export {default as ShapeSource} from './components/ShapeSource';
export type {ShapeSourceRef} from './components/ShapeSource';
export {default as RasterSource} from './components/RasterSource';
export {default as ImageSource} from './components/ImageSource';
export {default as Images} from './components/Images';
export {default as FillLayer} from './components/FillLayer';
export {default as FillExtrusionLayer} from './components/FillExtrusionLayer';
export {default as HeatmapLayer} from './components/HeatmapLayer';
export {default as LineLayer} from './components/LineLayer';
export {default as CircleLayer} from './components/CircleLayer';
export {default as SymbolLayer} from './components/SymbolLayer';
export {default as RasterLayer} from './components/RasterLayer';
export {default as BackgroundLayer} from './components/BackgroundLayer';
} from "./components/UserLocation";
export type { UserLocationRef } from "./components/UserLocation";
export { default as VectorSource } from "./components/VectorSource";
export { default as ShapeSource } from "./components/ShapeSource";
export type { ShapeSourceRef } from "./components/ShapeSource";
export { default as RasterSource } from "./components/RasterSource";
export { default as ImageSource } from "./components/ImageSource";
export { default as Images } from "./components/Images";
export { default as FillLayer } from "./components/FillLayer";
export { default as FillExtrusionLayer } from "./components/FillExtrusionLayer";
export { default as HeatmapLayer } from "./components/HeatmapLayer";
export { default as LineLayer } from "./components/LineLayer";
export { default as CircleLayer } from "./components/CircleLayer";
export { default as SymbolLayer } from "./components/SymbolLayer";
export { default as RasterLayer } from "./components/RasterLayer";
export { default as BackgroundLayer } from "./components/BackgroundLayer";
export {
default as locationManager,
type Location,
} from './modules/location/locationManager';
export {default as offlineManager} from './modules/offline/offlineManager';
export {default as OfflineCreatePackOptions} from './modules/offline/OfflineCreatePackOptions';
export {default as snapshotManager} from './modules/snapshot/snapshotManager';
export type {SnapshotInputOptions} from './modules/snapshot/SnapshotOptions';
export {default as MarkerView} from './components/MarkerView';
export {default as Animated} from './utils/animated/Animated';
export {default as Style} from './components/Style';
export {default as Logger, type LogLevel} from './utils/Logger';
} from "./modules/location/locationManager";
export { default as offlineManager } from "./modules/offline/offlineManager";
export { default as OfflineCreatePackOptions } from "./modules/offline/OfflineCreatePackOptions";
export { default as snapshotManager } from "./modules/snapshot/snapshotManager";
export type { SnapshotInputOptions } from "./modules/snapshot/SnapshotOptions";
export { default as MarkerView } from "./components/MarkerView";
export { default as Animated } from "./utils/animated/Animated";
export { default as Style } from "./components/Style";
export { default as Logger, type LogLevel } from "./utils/Logger";
export type {
FillLayerStyleProps as FillLayerStyle,
LineLayerStyleProps as LineLayerStyle,
Expand All @@ -58,7 +58,7 @@ export type {
HillshadeLayerStyleProps as HillshadeLayerStyle,
BackgroundLayerStyleProps as BackgroundLayerStyle,
LightLayerStyleProps as LightLayerStyle,
} from './utils/MaplibreStyles';
} from "./utils/MaplibreStyles";

/** @deprecated UserTrackingModes is deprecated use UserTrackingMode */
export const UserTrackingModes = UserTrackingMode;
Loading

0 comments on commit 56e5544

Please sign in to comment.