react-native-maps 0.30.0 → 0.30.1
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 0.30.1 - (January 3, 2022)
|
|
4
|
+
* Common: [#4011](https://github.com/react-native-maps/react-native-maps/pull/4011) Feature fix AnimatedRegion getAnimatedValue Issue
|
|
5
|
+
|
|
3
6
|
## 0.30.0 - (November 10, 2021)
|
|
4
7
|
* Common: [#3789](https://github.com/react-native-maps/react-native-maps/pull/3789) URLTile tile caching
|
|
5
8
|
* Common: [#3938](https://github.com/react-native-maps/react-native-maps/pull/3938) Add URLTile & WMSTile opacity property
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
import AnimatedRegion from '../lib/components/AnimatedRegion';
|
|
3
|
+
|
|
4
|
+
const VALUES = {
|
|
5
|
+
latitude: 5,
|
|
6
|
+
longitude: 5,
|
|
7
|
+
latitudeDelta: 0,
|
|
8
|
+
longitudeDelta: 0,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
describe('AnimatedRegion', () => {
|
|
12
|
+
it('converts numbers to instances of Animated.Value', () => {
|
|
13
|
+
const animatedRegion = new AnimatedRegion(VALUES);
|
|
14
|
+
|
|
15
|
+
expect(animatedRegion.latitude instanceof Animated.Value).toBe(true);
|
|
16
|
+
expect(animatedRegion.longitude instanceof Animated.Value).toBe(true);
|
|
17
|
+
expect(animatedRegion.latitudeDelta instanceof Animated.Value).toBe(true);
|
|
18
|
+
expect(animatedRegion.longitudeDelta instanceof Animated.Value).toBe(true);
|
|
19
|
+
|
|
20
|
+
const values = animatedRegion.__getValue();
|
|
21
|
+
|
|
22
|
+
expect(values.latitude).toEqual(VALUES.latitude);
|
|
23
|
+
expect(values.longitude).toEqual(VALUES.longitude);
|
|
24
|
+
expect(values.longitudeDelta).toEqual(VALUES.longitudeDelta);
|
|
25
|
+
expect(values.latitudeDelta).toEqual(VALUES.latitudeDelta);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('uses Animated.Value instances', () => {
|
|
29
|
+
const animatedRegion = new AnimatedRegion({
|
|
30
|
+
latitude: new Animated.Value(VALUES.latitude),
|
|
31
|
+
longitude: new Animated.Value(VALUES.longitude),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
expect(animatedRegion.latitude instanceof Animated.Value).toBe(true);
|
|
35
|
+
expect(animatedRegion.longitude instanceof Animated.Value).toBe(true);
|
|
36
|
+
expect(animatedRegion.latitudeDelta instanceof Animated.Value).toBe(true);
|
|
37
|
+
expect(animatedRegion.longitudeDelta instanceof Animated.Value).toBe(true);
|
|
38
|
+
|
|
39
|
+
const values = animatedRegion.__getValue();
|
|
40
|
+
|
|
41
|
+
expect(values.latitude).toEqual(VALUES.latitude);
|
|
42
|
+
expect(values.longitude).toEqual(VALUES.longitude);
|
|
43
|
+
expect(values.longitudeDelta).toEqual(VALUES.longitudeDelta);
|
|
44
|
+
expect(values.latitudeDelta).toEqual(VALUES.latitudeDelta);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('uses defaults converted to Animated.Value instances when none are supplied', () => {
|
|
48
|
+
const animatedRegion = new AnimatedRegion({});
|
|
49
|
+
|
|
50
|
+
expect(animatedRegion.latitude instanceof Animated.Value).toBe(true);
|
|
51
|
+
expect(animatedRegion.longitude instanceof Animated.Value).toBe(true);
|
|
52
|
+
expect(animatedRegion.latitudeDelta instanceof Animated.Value).toBe(true);
|
|
53
|
+
expect(animatedRegion.longitudeDelta instanceof Animated.Value).toBe(true);
|
|
54
|
+
|
|
55
|
+
const values = animatedRegion.__getValue();
|
|
56
|
+
|
|
57
|
+
expect(values.latitude).toEqual(0);
|
|
58
|
+
expect(values.longitude).toEqual(0);
|
|
59
|
+
expect(values.longitudeDelta).toEqual(VALUES.longitudeDelta);
|
|
60
|
+
expect(values.latitudeDelta).toEqual(VALUES.latitudeDelta);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -27,9 +27,12 @@ const defaultValues = {
|
|
|
27
27
|
let _uniqueId = 1;
|
|
28
28
|
|
|
29
29
|
const getAnimatedValue = (valueIn, fallback) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
if (valueIn instanceof Animated.Value) {
|
|
31
|
+
return valueIn;
|
|
32
|
+
} else if (typeof valueIn === 'number') {
|
|
33
|
+
return new Animated.Value(valueIn);
|
|
34
|
+
}
|
|
35
|
+
return new Animated.Value(fallback);
|
|
33
36
|
};
|
|
34
37
|
|
|
35
38
|
export default class AnimatedMapRegion extends AnimatedWithChildren {
|
package/package.json
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
"description": "React Native Mapview component for iOS + Android",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "Leland Richardson <leland.m.richardson@gmail.com>",
|
|
6
|
-
"version": "0.30.
|
|
6
|
+
"version": "0.30.1",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"lint": "./node_modules/eslint/bin/eslint.js .",
|
|
9
|
-
"ci": "npm run lint"
|
|
9
|
+
"ci": "npm run lint",
|
|
10
|
+
"test": "jest"
|
|
10
11
|
},
|
|
11
12
|
"repository": {
|
|
12
13
|
"type": "git",
|
|
@@ -27,11 +28,28 @@
|
|
|
27
28
|
"react-native-web": ">= 0.11"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@react-native-community/eslint-config": "3.0.1",
|
|
31
|
+
"@react-native-community/eslint-config": "^3.0.1",
|
|
32
|
+
"babel-jest": "^27.3.1",
|
|
31
33
|
"eslint": "7.32.0",
|
|
34
|
+
"jest": "^27.3.1",
|
|
35
|
+
"react": "^17.0.2",
|
|
36
|
+
"react-native": "^0.66.3",
|
|
32
37
|
"typescript": "^4.4.3"
|
|
33
38
|
},
|
|
34
39
|
"dependencies": {
|
|
35
40
|
"@types/geojson": "^7946.0.7"
|
|
41
|
+
},
|
|
42
|
+
"jest": {
|
|
43
|
+
"preset": "react-native",
|
|
44
|
+
"testRegex": "<rootDir>/__tests__/.*|(\\.|/)(test|spec)\\.jsx?$",
|
|
45
|
+
"transform": {
|
|
46
|
+
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
|
|
47
|
+
},
|
|
48
|
+
"moduleFileExtensions": [
|
|
49
|
+
"js"
|
|
50
|
+
],
|
|
51
|
+
"transformIgnorePatterns": [
|
|
52
|
+
"node_modules/(?!@react-native|react-native)"
|
|
53
|
+
]
|
|
36
54
|
}
|
|
37
55
|
}
|