react-native-map4d-services 1.0.2 → 1.1.0

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/package.json CHANGED
@@ -1,150 +1,150 @@
1
- {
2
- "name": "react-native-map4d-services",
3
- "version": "1.0.2",
4
- "description": "React Native Map4dServices for iOS + Android",
5
- "main": "lib/commonjs/index",
6
- "module": "lib/module/index",
7
- "types": "lib/typescript/index.d.ts",
8
- "react-native": "src/index",
9
- "source": "src/index",
10
- "files": [
11
- "src",
12
- "lib",
13
- "android",
14
- "ios",
15
- "cpp",
16
- "react-native-map4d-services.podspec",
17
- "!lib/typescript/example",
18
- "!android/build",
19
- "!ios/build",
20
- "!**/__tests__",
21
- "!**/__fixtures__",
22
- "!**/__mocks__"
23
- ],
24
- "scripts": {
25
- "test": "jest",
26
- "typescript": "tsc --noEmit",
27
- "lint": "eslint \"**/*.{js,ts,tsx}\"",
28
- "prepare": "bob build",
29
- "release": "release-it",
30
- "example": "yarn --cwd example",
31
- "pods": "cd example && pod-install --quiet",
32
- "bootstrap": "yarn example && yarn && yarn pods"
33
- },
34
- "keywords": [
35
- "react",
36
- "react-native",
37
- "map4d",
38
- "services",
39
- "map4d-services",
40
- "iotlink"
41
- ],
42
- "repository": "https://github.com/map4d/map4d-services-react-native",
43
- "author": "IOTLink <admin@iotlink.com.vn> (https://iotlink.com.vn/)",
44
- "license": "MIT",
45
- "bugs": {
46
- "url": "https://github.com/map4d/map4d-services-react-native/issues"
47
- },
48
- "homepage": "https://github.com/map4d/map4d-services-react-native#readme",
49
- "publishConfig": {
50
- "registry": "https://registry.npmjs.org/"
51
- },
52
- "devDependencies": {
53
- "@commitlint/config-conventional": "^11.0.0",
54
- "@react-native-community/eslint-config": "^2.0.0",
55
- "@release-it/conventional-changelog": "^2.0.0",
56
- "@types/jest": "^26.0.0",
57
- "@types/react": "^16.9.19",
58
- "@types/react-native": "0.62.13",
59
- "commitlint": "^11.0.0",
60
- "eslint": "^7.2.0",
61
- "eslint-config-prettier": "^7.0.0",
62
- "eslint-plugin-prettier": "^3.1.3",
63
- "husky": "^6.0.0",
64
- "jest": "^26.0.1",
65
- "pod-install": "^0.1.0",
66
- "prettier": "^2.0.5",
67
- "react": "16.13.1",
68
- "react-native": "0.63.4",
69
- "react-native-builder-bob": "^0.18.0",
70
- "release-it": "^14.2.2",
71
- "typescript": "^4.1.3"
72
- },
73
- "peerDependencies": {
74
- "react": "*",
75
- "react-native": "*"
76
- },
77
- "jest": {
78
- "preset": "react-native",
79
- "modulePathIgnorePatterns": [
80
- "<rootDir>/example/node_modules",
81
- "<rootDir>/lib/"
82
- ]
83
- },
84
- "commitlint": {
85
- "extends": [
86
- "@commitlint/config-conventional"
87
- ]
88
- },
89
- "release-it": {
90
- "git": {
91
- "commitMessage": "chore: release ${version}",
92
- "tagName": "v${version}"
93
- },
94
- "npm": {
95
- "publish": true
96
- },
97
- "github": {
98
- "release": true
99
- },
100
- "plugins": {
101
- "@release-it/conventional-changelog": {
102
- "preset": "angular"
103
- }
104
- }
105
- },
106
- "eslintConfig": {
107
- "root": true,
108
- "extends": [
109
- "@react-native-community",
110
- "prettier"
111
- ],
112
- "rules": {
113
- "prettier/prettier": [
114
- "error",
115
- {
116
- "quoteProps": "consistent",
117
- "singleQuote": true,
118
- "tabWidth": 2,
119
- "trailingComma": "es5",
120
- "useTabs": false
121
- }
122
- ]
123
- }
124
- },
125
- "eslintIgnore": [
126
- "node_modules/",
127
- "lib/"
128
- ],
129
- "prettier": {
130
- "quoteProps": "consistent",
131
- "singleQuote": true,
132
- "tabWidth": 2,
133
- "trailingComma": "es5",
134
- "useTabs": false
135
- },
136
- "react-native-builder-bob": {
137
- "source": "src",
138
- "output": "lib",
139
- "targets": [
140
- "commonjs",
141
- "module",
142
- [
143
- "typescript",
144
- {
145
- "project": "tsconfig.build.json"
146
- }
147
- ]
148
- ]
149
- }
150
- }
1
+ {
2
+ "name": "react-native-map4d-services",
3
+ "version": "1.1.0",
4
+ "description": "React Native Map4dServices for iOS + Android",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "react-native-map4d-services.podspec",
17
+ "!lib/typescript/example",
18
+ "!android/build",
19
+ "!ios/build",
20
+ "!**/__tests__",
21
+ "!**/__fixtures__",
22
+ "!**/__mocks__"
23
+ ],
24
+ "scripts": {
25
+ "test": "jest",
26
+ "typescript": "tsc --noEmit",
27
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
28
+ "prepare": "bob build",
29
+ "release": "release-it",
30
+ "example": "yarn --cwd example",
31
+ "pods": "cd example && pod-install --quiet",
32
+ "bootstrap": "yarn example && yarn && yarn pods"
33
+ },
34
+ "keywords": [
35
+ "react",
36
+ "react-native",
37
+ "map4d",
38
+ "services",
39
+ "map4d-services",
40
+ "iotlink"
41
+ ],
42
+ "repository": "https://github.com/map4d/map4d-services-react-native",
43
+ "author": "IOTLink <admin@iotlink.com.vn> (https://iotlink.com.vn/)",
44
+ "license": "MIT",
45
+ "bugs": {
46
+ "url": "https://github.com/map4d/map4d-services-react-native/issues"
47
+ },
48
+ "homepage": "https://github.com/map4d/map4d-services-react-native#readme",
49
+ "publishConfig": {
50
+ "registry": "https://registry.npmjs.org/"
51
+ },
52
+ "devDependencies": {
53
+ "@commitlint/config-conventional": "^11.0.0",
54
+ "@react-native-community/eslint-config": "^2.0.0",
55
+ "@release-it/conventional-changelog": "^2.0.0",
56
+ "@types/jest": "^26.0.0",
57
+ "@types/react": "^16.9.19",
58
+ "@types/react-native": "0.62.13",
59
+ "commitlint": "^11.0.0",
60
+ "eslint": "^7.2.0",
61
+ "eslint-config-prettier": "^7.0.0",
62
+ "eslint-plugin-prettier": "^3.1.3",
63
+ "husky": "^6.0.0",
64
+ "jest": "^26.0.1",
65
+ "pod-install": "^0.1.0",
66
+ "prettier": "^2.0.5",
67
+ "react": "16.13.1",
68
+ "react-native": "0.63.4",
69
+ "react-native-builder-bob": "^0.18.0",
70
+ "release-it": "^14.2.2",
71
+ "typescript": "^4.1.3"
72
+ },
73
+ "peerDependencies": {
74
+ "react": "*",
75
+ "react-native": "*"
76
+ },
77
+ "jest": {
78
+ "preset": "react-native",
79
+ "modulePathIgnorePatterns": [
80
+ "<rootDir>/example/node_modules",
81
+ "<rootDir>/lib/"
82
+ ]
83
+ },
84
+ "commitlint": {
85
+ "extends": [
86
+ "@commitlint/config-conventional"
87
+ ]
88
+ },
89
+ "release-it": {
90
+ "git": {
91
+ "commitMessage": "chore: release ${version}",
92
+ "tagName": "v${version}"
93
+ },
94
+ "npm": {
95
+ "publish": true
96
+ },
97
+ "github": {
98
+ "release": true
99
+ },
100
+ "plugins": {
101
+ "@release-it/conventional-changelog": {
102
+ "preset": "angular"
103
+ }
104
+ }
105
+ },
106
+ "eslintConfig": {
107
+ "root": true,
108
+ "extends": [
109
+ "@react-native-community",
110
+ "prettier"
111
+ ],
112
+ "rules": {
113
+ "prettier/prettier": [
114
+ "error",
115
+ {
116
+ "quoteProps": "consistent",
117
+ "singleQuote": true,
118
+ "tabWidth": 2,
119
+ "trailingComma": "es5",
120
+ "useTabs": false
121
+ }
122
+ ]
123
+ }
124
+ },
125
+ "eslintIgnore": [
126
+ "node_modules/",
127
+ "lib/"
128
+ ],
129
+ "prettier": {
130
+ "quoteProps": "consistent",
131
+ "singleQuote": true,
132
+ "tabWidth": 2,
133
+ "trailingComma": "es5",
134
+ "useTabs": false
135
+ },
136
+ "react-native-builder-bob": {
137
+ "source": "src",
138
+ "output": "lib",
139
+ "targets": [
140
+ "commonjs",
141
+ "module",
142
+ [
143
+ "typescript",
144
+ {
145
+ "project": "tsconfig.build.json"
146
+ }
147
+ ]
148
+ ]
149
+ }
150
+ }
@@ -1,20 +1,20 @@
1
- require "json"
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
-
5
- Pod::Spec.new do |s|
6
- s.name = "react-native-map4d-services"
7
- s.version = package["version"]
8
- s.summary = package["description"]
9
- s.homepage = package["homepage"]
10
- s.license = package["license"]
11
- s.authors = package["author"]
12
-
13
- s.platforms = { :ios => "10.0" }
14
- s.source = { :git => "https://github.com/map4d/map4d-services-react-native.git", :tag => "#{s.version}" }
15
-
16
- s.source_files = "ios/**/*.{h,m,mm}"
17
-
18
- s.dependency "React-Core"
19
- s.dependency "Map4dServices", "~> 2.0.0"
20
- end
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "react-native-map4d-services"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => "11.0" }
14
+ s.source = { :git => "https://github.com/map4d/map4d-services-react-native.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm}"
17
+
18
+ s.dependency "React-Core"
19
+ s.dependency "Map4dServices", "~> 2.4.0"
20
+ end
package/src/index.tsx CHANGED
@@ -1,175 +1,150 @@
1
- import { NativeModules, Platform } from 'react-native';
2
-
3
- const LINKING_ERROR =
4
- `The package 'react-native-map4d-services' doesn't seem to be linked. Make sure: \n\n` +
5
- Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
6
- '- You rebuilt the app after installing the package\n' +
7
- '- You are not using Expo managed workflow\n';
8
-
9
- const Map4dServices = NativeModules.Map4dServices
10
- ? NativeModules.Map4dServices
11
- : new Proxy(
12
- {},
13
- {
14
- get() {
15
- throw new Error(LINKING_ERROR);
16
- },
17
- }
18
- );
19
-
20
- export type MFLocationComponent = {
21
- latitude: number,
22
- longitude: number,
23
- alias?: string,
24
- }
25
-
26
- export type MFViewboxComponent = {
27
- southwest: MFLocationComponent,
28
- northeast: MFLocationComponent,
29
- }
30
-
31
- export enum MFTravelMode {
32
- car = 'car',
33
- bike = 'bike',
34
- foot = 'foot',
35
- motorcycle = 'motorcycle',
36
- }
37
-
38
- export enum MFRouteWeighting {
39
- shortest = 'shortest',
40
- fastest = 'fastest',
41
- balance = 'balance',
42
- }
43
-
44
- export enum MFLanguageResult {
45
- en = 'en',
46
- vi = 'vi',
47
- }
48
-
49
- export enum MFRouteType {
50
- motorway = 'motorway',
51
- trunk = 'trunk',
52
- ferry = 'ferry',
53
- bridge = 'bridge',
54
- tunnel = 'tunnel',
55
- }
56
-
57
- export type MFRouteRestriction = {
58
- location?: MFLocationComponent,
59
- radius?: number,
60
- viewbox?: MFViewboxComponent,
61
- path?: MFLocationComponent[],
62
- types?: MFRouteType[] | string[]
63
- }
64
-
65
- export type MFSuggestionParams = {
66
- text: string,
67
- location?: MFLocationComponent,
68
- acronym?: boolean,
69
- }
70
-
71
- export type MFTextSearchParams = {
72
- text: string,
73
- types?: string[],
74
- datetime?: number,
75
- location?: MFLocationComponent,
76
- }
77
-
78
- export type MFNearbySearchParams = {
79
- location: MFLocationComponent,
80
- radius: number,
81
- text?: string,
82
- types?: string[],
83
- tags?: string[],
84
- datetime?: number,
85
- }
86
-
87
- export type MFViewboxSearchParams = {
88
- viewbox: MFViewboxComponent,
89
- text?: string,
90
- types?: string[],
91
- tags?: string[],
92
- datetime?: number,
93
- }
94
-
95
- export type MFGeocodeParams = {
96
- location?: MFLocationComponent,
97
- address?: string,
98
- viewbox?: MFViewboxComponent,
99
- }
100
-
101
- export type MFDirectionsParams = {
102
- origin: MFLocationComponent,
103
- destination: MFLocationComponent,
104
- waypoints?: MFLocationComponent[],
105
- mode?: MFTravelMode | string,
106
- weighting?: MFRouteWeighting | string,
107
- language?: MFLanguageResult | string,
108
- restriction?: MFRouteRestriction,
109
- }
110
-
111
- export type MFRouteETAParams = {
112
- origins: MFLocationComponent[],
113
- destination: MFLocationComponent,
114
- mode?: MFTravelMode | string,
115
- weighting?: MFRouteWeighting | string,
116
- language?: MFLanguageResult | string,
117
- restriction?: MFRouteRestriction,
118
- }
119
-
120
- export type MFDistanceMatrixParams = {
121
- origins: MFLocationComponent[],
122
- destinations: MFLocationComponent[],
123
- mode?: MFTravelMode | string,
124
- weighting?: MFRouteWeighting | string,
125
- language?: MFLanguageResult | string,
126
- restriction?: MFRouteRestriction,
127
- }
128
-
129
- export type MFGraphRouteParams = {
130
- locations: MFLocationComponent[],
131
- mode?: MFTravelMode | string,
132
- weighting?: MFRouteWeighting | string,
133
- language?: MFLanguageResult | string,
134
- restriction?: MFRouteRestriction,
135
- }
136
-
137
- export function fetchSuggestion(params: MFSuggestionParams): Promise<any> {
138
- return Map4dServices.fetchSuggestion(params);
139
- }
140
-
141
- export function fetchPlaceDetail(placeId: string): Promise<any> {
142
- return Map4dServices.fetchPlaceDetail(placeId);
143
- }
144
-
145
- export function fetchTextSearch(params: MFTextSearchParams): Promise<any> {
146
- return Map4dServices.fetchTextSearch(params);
147
- }
148
-
149
- export function fetchNearbySearch(params: MFNearbySearchParams): Promise<any> {
150
- return Map4dServices.fetchNearbySearch(params);
151
- }
152
-
153
- export function fetchViewboxSearch(params: MFViewboxSearchParams): Promise<any> {
154
- return Map4dServices.fetchViewboxSearch(params);
155
- }
156
-
157
- export function fetchGeocode(params: MFGeocodeParams): Promise<any> {
158
- return Map4dServices.fetchGeocode(params);
159
- }
160
-
161
- export function fetchDirections(params: MFDirectionsParams): Promise<any> {
162
- return Map4dServices.fetchDirections(params);
163
- }
164
-
165
- export function fetchRouteETA(params: MFRouteETAParams): Promise<any> {
166
- return Map4dServices.fetchRouteETA(params);
167
- }
168
-
169
- export function fetchDistanceMatrix(params: MFDistanceMatrixParams): Promise<any> {
170
- return Map4dServices.fetchDistanceMatrix(params);
171
- }
172
-
173
- export function fetchGraphRoute(params: MFGraphRouteParams): Promise<any> {
174
- return Map4dServices.fetchGraphRoute(params);
175
- }
1
+ import { NativeModules, Platform } from 'react-native';
2
+
3
+ const LINKING_ERROR =
4
+ `The package 'react-native-map4d-services' doesn't seem to be linked. Make sure: \n\n` +
5
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
6
+ '- You rebuilt the app after installing the package\n' +
7
+ '- You are not using Expo managed workflow\n';
8
+
9
+ const Map4dServices = NativeModules.Map4dServices
10
+ ? NativeModules.Map4dServices
11
+ : new Proxy(
12
+ {},
13
+ {
14
+ get() {
15
+ throw new Error(LINKING_ERROR);
16
+ },
17
+ }
18
+ );
19
+
20
+ export type MFLocationComponent = {
21
+ latitude: number,
22
+ longitude: number,
23
+ alias?: string,
24
+ }
25
+
26
+ export type MFViewboxComponent = {
27
+ southwest: MFLocationComponent,
28
+ northeast: MFLocationComponent,
29
+ }
30
+
31
+ export enum MFTravelMode {
32
+ car = 'car',
33
+ bike = 'bike',
34
+ foot = 'foot',
35
+ motorcycle = 'motorcycle',
36
+ }
37
+
38
+ export enum MFRouteWeighting {
39
+ shortest = 'shortest',
40
+ fastest = 'fastest',
41
+ balance = 'balance',
42
+ }
43
+
44
+ export enum MFLanguageResult {
45
+ en = 'en',
46
+ vi = 'vi',
47
+ }
48
+
49
+ export enum MFRouteType {
50
+ motorway = 'motorway',
51
+ trunk = 'trunk',
52
+ ferry = 'ferry',
53
+ bridge = 'bridge',
54
+ tunnel = 'tunnel',
55
+ }
56
+
57
+ export type MFRouteRestriction = {
58
+ location?: MFLocationComponent,
59
+ radius?: number,
60
+ viewbox?: MFViewboxComponent,
61
+ path?: MFLocationComponent[],
62
+ types?: MFRouteType[] | string[]
63
+ }
64
+
65
+ export type MFSuggestionParams = {
66
+ text: string,
67
+ location?: MFLocationComponent,
68
+ acronym?: boolean,
69
+ }
70
+
71
+ export type MFTextSearchParams = {
72
+ text: string,
73
+ types?: string[],
74
+ datetime?: number,
75
+ location?: MFLocationComponent,
76
+ }
77
+
78
+ export type MFNearbySearchParams = {
79
+ location: MFLocationComponent,
80
+ radius: number,
81
+ text?: string,
82
+ types?: string[],
83
+ tags?: string[],
84
+ datetime?: number,
85
+ }
86
+
87
+ export type MFViewboxSearchParams = {
88
+ viewbox: MFViewboxComponent,
89
+ text?: string,
90
+ types?: string[],
91
+ tags?: string[],
92
+ datetime?: number,
93
+ }
94
+
95
+ export type MFGeocodeParams = {
96
+ location?: MFLocationComponent,
97
+ address?: string,
98
+ viewbox?: MFViewboxComponent,
99
+ }
100
+
101
+ export type MFDirectionsParams = {
102
+ origin: MFLocationComponent,
103
+ destination: MFLocationComponent,
104
+ waypoints?: MFLocationComponent[],
105
+ mode?: MFTravelMode | string,
106
+ weighting?: MFRouteWeighting | string,
107
+ language?: MFLanguageResult | string,
108
+ restriction?: MFRouteRestriction,
109
+ }
110
+
111
+ export type MFDistanceMatrixParams = {
112
+ origins: MFLocationComponent[],
113
+ destinations: MFLocationComponent[],
114
+ mode?: MFTravelMode | string,
115
+ weighting?: MFRouteWeighting | string,
116
+ language?: MFLanguageResult | string,
117
+ restriction?: MFRouteRestriction,
118
+ }
119
+
120
+ export function fetchSuggestion(params: MFSuggestionParams): Promise<any> {
121
+ return Map4dServices.fetchSuggestion(params);
122
+ }
123
+
124
+ export function fetchPlaceDetail(placeId: string): Promise<any> {
125
+ return Map4dServices.fetchPlaceDetail(placeId);
126
+ }
127
+
128
+ export function fetchTextSearch(params: MFTextSearchParams): Promise<any> {
129
+ return Map4dServices.fetchTextSearch(params);
130
+ }
131
+
132
+ export function fetchNearbySearch(params: MFNearbySearchParams): Promise<any> {
133
+ return Map4dServices.fetchNearbySearch(params);
134
+ }
135
+
136
+ export function fetchViewboxSearch(params: MFViewboxSearchParams): Promise<any> {
137
+ return Map4dServices.fetchViewboxSearch(params);
138
+ }
139
+
140
+ export function fetchGeocode(params: MFGeocodeParams): Promise<any> {
141
+ return Map4dServices.fetchGeocode(params);
142
+ }
143
+
144
+ export function fetchDirections(params: MFDirectionsParams): Promise<any> {
145
+ return Map4dServices.fetchDirections(params);
146
+ }
147
+
148
+ export function fetchDistanceMatrix(params: MFDistanceMatrixParams): Promise<any> {
149
+ return Map4dServices.fetchDistanceMatrix(params);
150
+ }