Add initial implementation of Map SDK and example app
- Create README for the main repository and example app - Implement example app with MapView and Marker components - Add package.json for example app with necessary scripts and dependencies - Create Map SDK package with TypeScript wrapper around react-native-maps - Define TypeScript configuration for the SDK
This commit is contained in:
33
packages/map-sdk/README.md
Normal file
33
packages/map-sdk/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# @lynkedup/map-sdk
|
||||
|
||||
A small TypeScript wrapper around `react-native-maps` to provide a consistent API and typed components.
|
||||
|
||||
## Usage
|
||||
|
||||
Install peer deps in your app:
|
||||
|
||||
```
|
||||
npm install react-native react-native-maps
|
||||
# and add this package via workspace or npm/yarn
|
||||
```
|
||||
|
||||
Basic usage:
|
||||
|
||||
```ts
|
||||
import React from 'react';
|
||||
import { MapView, Marker } from '@lynkedup/map-sdk';
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<MapView
|
||||
style={{ flex: 1 }}
|
||||
initialRegion={{ latitude: 37.78825, longitude: -122.4324, latitudeDelta: 0.0922, longitudeDelta: 0.0421 }}
|
||||
>
|
||||
<Marker coordinate={{ latitude: 37.78825, longitude: -122.4324 }} />
|
||||
</MapView>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
## Notes
|
||||
- This package delegates to `react-native-maps` for platform implementations. Follow `react-native-maps` docs for iOS/Android setup (Google Maps API key, pods, manifest permissions).
|
||||
25
packages/map-sdk/package.json
Normal file
25
packages/map-sdk/package.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "@lynkedup/map-sdk",
|
||||
"version": "0.1.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"lint": "eslint . --ext .ts,.tsx"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=17",
|
||||
"react-native": ">=0.70",
|
||||
"react-native-maps": "^1.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.0.0",
|
||||
"eslint": "^8.0.0",
|
||||
"@types/react": "^18.0.0",
|
||||
"@types/react-native": "^0.70.0"
|
||||
}
|
||||
}
|
||||
10
packages/map-sdk/src/MapView.tsx
Normal file
10
packages/map-sdk/src/MapView.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import React from 'react';
|
||||
import RNMapView, { MapViewProps as RNMapViewProps } from 'react-native-maps';
|
||||
|
||||
export type MapProps = RNMapViewProps;
|
||||
|
||||
const MapView: React.FC<MapProps> = (props) => {
|
||||
return <RNMapView {...props}>{props.children}</RNMapView>;
|
||||
};
|
||||
|
||||
export default MapView;
|
||||
2
packages/map-sdk/src/index.ts
Normal file
2
packages/map-sdk/src/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as MapView } from './MapView';
|
||||
export { Marker, Polyline, PROVIDER_GOOGLE } from 'react-native-maps';
|
||||
15
packages/map-sdk/tsconfig.json
Normal file
15
packages/map-sdk/tsconfig.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2019",
|
||||
"module": "CommonJS",
|
||||
"jsx": "react",
|
||||
"declaration": true,
|
||||
"outDir": "dist",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user