Skip to content

Commit dde312f

Browse files
committed
fix: prevent errors in production
# Conflicts: # src/index.common.ts
1 parent 7759b99 commit dde312f

File tree

3 files changed

+40
-26
lines changed

3 files changed

+40
-26
lines changed

src/index.android.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* eslint-disable no-redeclare */
2-
import { Color } from '@nativescript/core/color';
2+
import { Color } from '@nativescript/core';
33
import { NativePropertyOptions } from '.';
4-
import { BaseNative, _createImageSourceFromSrc, nativeMapVecProperty, nativeProperty } from './index.common';
5-
import { DefaultLatLonKeys, GenericMapPos, MapPos, MapPosVector, MapPosVectorVector, toNativeMapPos } from './core';
6-
import { FeatureCollection } from './geometry/feature';
4+
import { DefaultLatLonKeys, GenericMapPos, MapPos, MapPosVector, MapPosVectorVector, fromNativeMapVec, toNativeMapPos, toNativeMapVec } from './core';
75
import { Geometry } from './geometry';
8-
export { BaseNative, nativeProperty, nativeMapVecProperty };
6+
import { FeatureCollection } from './geometry/feature';
7+
import { BaseNative, _createImageSourceFromSrc, nativeProperty } from './index.common';
8+
export { BaseNative, nativeProperty };
99

1010
export function nativeColorProperty(target: any, k?, desc?: PropertyDescriptor): any;
1111
export function nativeColorProperty(options: NativePropertyOptions): (target: any, k?, desc?: PropertyDescriptor) => any;
@@ -146,3 +146,17 @@ export function mapPosVectorVectorFromArgs(positions: MapPosVectorVector | MapPo
146146
}
147147
return nativePoses;
148148
}
149+
150+
export function nativeMapVecProperty(target: any, k?, desc?: PropertyDescriptor): any;
151+
export function nativeMapVecProperty(options: NativePropertyOptions): (target: any, k?, desc?: PropertyDescriptor) => any;
152+
export function nativeMapVecProperty(...args) {
153+
return nativeProperty(
154+
{
155+
converter: {
156+
fromNative: fromNativeMapVec,
157+
toNative: toNativeMapVec,
158+
},
159+
},
160+
...args
161+
);
162+
}

src/index.common.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { ImageSource } from '@nativescript/core/image-source';
44
import { ImageAsset } from '@nativescript/core/image-asset';
55
import { RESOURCE_PREFIX, isDataURI, isFileOrResourcePath } from '@nativescript/core/utils/utils';
66
import { isAndroid } from '@nativescript/core/platform';
7+
import { knownFolders, path } from '@nativescript/core/file-system';
8+
import { NativePropertyOptions } from '.';
79

810
function createGetter(key: string, options: NativePropertyOptions) {
911
const nativeGetterName = ((isAndroid ? options.android : options.ios) || options).nativeGetterName || 'get' + key.charAt(0).toUpperCase() + key.slice(1);
@@ -53,19 +55,6 @@ export function nativeProperty(...args) {
5355
return nativePropertyGenerator(args[startIndex], args[startIndex + 1], options || {});
5456
}
5557
}
56-
export function nativeMapVecProperty(target: any, k?, desc?: PropertyDescriptor): any;
57-
export function nativeMapVecProperty(options: NativePropertyOptions): (target: any, k?, desc?: PropertyDescriptor) => any;
58-
export function nativeMapVecProperty(...args) {
59-
return nativeProperty(
60-
{
61-
converter: {
62-
fromNative: fromNativeMapVec,
63-
toNative: toNativeMapVec,
64-
},
65-
},
66-
...args
67-
);
68-
}
6958

7059
export function nonenumerable(target: any, name: string): void;
7160
export function nonenumerable(target: any, name: string, desc: PropertyDescriptor): PropertyDescriptor;
@@ -148,9 +137,6 @@ export function capitalize(s) {
148137
return s.charAt(0).toUpperCase() + s.slice(1);
149138
}
150139

151-
import { knownFolders, path } from '@nativescript/core/file-system';
152-
import { NativePropertyOptions } from '.';
153-
import { fromNativeMapVec, toNativeMapVec } from './core';
154140
let currentAppFolder: string;
155141

156142
export function getFileName(str: string): string {

src/index.ios.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* eslint-disable no-redeclare */
2-
import { BaseNative, _createImageSourceFromSrc, nativeMapVecProperty, nativeProperty } from './index.common';
3-
import { Color } from '@nativescript/core/color';
4-
import { DefaultLatLonKeys, MapPos, MapPosVector, MapPosVectorVector, toNativeMapPos } from './core';
2+
import { Color } from '@nativescript/core';
53
import { NativePropertyOptions } from '.';
6-
import { FeatureCollection } from './geometry/feature';
4+
import { DefaultLatLonKeys, GenericMapPos, MapPos, MapPosVector, MapPosVectorVector, fromNativeMapVec, toNativeMapPos, toNativeMapVec } from './core';
75
import { Geometry } from './geometry';
8-
export { BaseNative, nativeMapVecProperty, nativeProperty };
6+
import { FeatureCollection } from './geometry/feature';
7+
import { BaseNative, _createImageSourceFromSrc, nativeProperty } from './index.common';
8+
export { BaseNative, nativeProperty };
99

1010
export function nativeColorProperty(target: any, k?, desc?: PropertyDescriptor): any;
1111
export function nativeColorProperty(options: NativePropertyOptions): (target: any, k?, desc?: PropertyDescriptor) => any;
@@ -135,3 +135,17 @@ export function mapPosVectorVectorFromArgs(positions: MapPosVectorVector | MapPo
135135
}
136136
return nativePoses;
137137
}
138+
139+
export function nativeMapVecProperty(target: any, k?, desc?: PropertyDescriptor): any;
140+
export function nativeMapVecProperty(options: NativePropertyOptions): (target: any, k?, desc?: PropertyDescriptor) => any;
141+
export function nativeMapVecProperty(...args) {
142+
return nativeProperty(
143+
{
144+
converter: {
145+
fromNative: fromNativeMapVec,
146+
toNative: toNativeMapVec,
147+
},
148+
},
149+
...args
150+
);
151+
}

0 commit comments

Comments
 (0)