react-native-vector-image 0.4.5 → 0.5.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/README.md +10 -8
- package/package.json +5 -7
- package/src/cli/getAssets.js +3 -3
- package/src/index.js +4 -4
- package/src/VectorImageCompat.android.js +0 -6
- package/src/VectorImageCompat.ios.js +0 -1
package/README.md
CHANGED
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```sh
|
|
15
|
-
yarn add react-native-vector-image
|
|
15
|
+
yarn add react-native-vector-image
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
For expo, see [`@zamplyy/react-native-vector-image-plugin`](https://github.com/zamplyy/react-native-vector-image-plugin).
|
|
19
|
+
|
|
18
20
|
### Android
|
|
19
21
|
|
|
20
22
|
Edit `android/app/build.gradle` to look like this (without the +):
|
|
21
23
|
|
|
22
24
|
```diff
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
apply from: "../../node_modules/react-native/react.gradle"
|
|
25
|
+
apply plugin: "com.android.application"
|
|
26
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
27
|
+
apply plugin: "com.facebook.react"
|
|
28
28
|
+ apply from: "../../node_modules/react-native-vector-image/strip_svgs.gradle"
|
|
29
29
|
```
|
|
30
30
|
|
|
@@ -35,8 +35,10 @@ Open your project in Xcode, select the _Build Phases_ tab, and edit the `Bundle
|
|
|
35
35
|
```diff
|
|
36
36
|
set -e
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
WITH_ENVIRONMENT="$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"
|
|
39
|
+
REACT_NATIVE_XCODE="$REACT_NATIVE_PATH/scripts/react-native-xcode.sh"
|
|
40
|
+
|
|
41
|
+
/bin/sh -c "$WITH_ENVIRONMENT $REACT_NATIVE_XCODE"
|
|
40
42
|
+ ../node_modules/react-native-vector-image/strip_svgs.sh
|
|
41
43
|
```
|
|
42
44
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-vector-image",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Native vector images generated from SVG",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -42,13 +42,11 @@
|
|
|
42
42
|
"tempy": "^1.0.1",
|
|
43
43
|
"yargs": "^16.2.0"
|
|
44
44
|
},
|
|
45
|
-
"peerDependencies": {
|
|
46
|
-
"@klarna/react-native-vector-drawable": ">=0.4.0"
|
|
47
|
-
},
|
|
48
45
|
"devDependencies": {
|
|
49
46
|
"jest": "^26.6.3",
|
|
50
|
-
"metro": ">=0.
|
|
51
|
-
"metro-config": ">=0.
|
|
47
|
+
"metro": ">=0.83.3",
|
|
48
|
+
"metro-config": ">=0.83.3",
|
|
52
49
|
"prettier": "^2.2.1"
|
|
53
|
-
}
|
|
50
|
+
},
|
|
51
|
+
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
|
|
54
52
|
}
|
package/src/cli/getAssets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const Server = require('metro/
|
|
1
|
+
const { default: Server } = require('metro/private/Server');
|
|
2
2
|
const { loadConfig } = require('metro-config');
|
|
3
|
-
const output = require('metro/
|
|
3
|
+
const output = require('metro/private/shared/output/bundle');
|
|
4
4
|
|
|
5
5
|
const getBabelTransformerPath = () => {
|
|
6
6
|
try {
|
|
@@ -10,7 +10,7 @@ const getBabelTransformerPath = () => {
|
|
|
10
10
|
// to ensure backwards compatibility with old RN versions (RN < 73)
|
|
11
11
|
return require.resolve('metro-react-native-babel-transformer');
|
|
12
12
|
}
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
|
|
15
15
|
async function getAssets(options) {
|
|
16
16
|
const args = {
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { Image } from 'react-native';
|
|
3
|
+
import { getAssetByID } from '@react-native/assets-registry/registry';
|
|
4
4
|
import getResourceName from './getResourceName';
|
|
5
5
|
|
|
6
6
|
export default function VectorImage({ source, style, ...props }) {
|
|
7
|
-
const asset =
|
|
7
|
+
const asset = getAssetByID(source);
|
|
8
8
|
if (!asset) {
|
|
9
9
|
console.warn(
|
|
10
10
|
`No asset registered for source "${source}", you may have to generate assets and recompile`
|
|
@@ -13,7 +13,7 @@ export default function VectorImage({ source, style, ...props }) {
|
|
|
13
13
|
}
|
|
14
14
|
const resourceName = getResourceName(asset);
|
|
15
15
|
return (
|
|
16
|
-
<
|
|
16
|
+
<Image
|
|
17
17
|
source={{ uri: resourceName }}
|
|
18
18
|
style={[{ width: asset.width, height: asset.height }, style]}
|
|
19
19
|
{...props}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Image as VectorImageCompat } from 'react-native';
|