@applicaster/zapp-react-native-ui-components 15.1.21-rc.2 → 15.1.21
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.
|
@@ -24,7 +24,9 @@ const MemoizedImage = React.memo(QBImage, R.equals);
|
|
|
24
24
|
const isValidExternalSource = (source): boolean =>
|
|
25
25
|
source?.uri?.startsWith("http") ||
|
|
26
26
|
source?.uri?.startsWith("data:image") ||
|
|
27
|
-
source?.uri?.startsWith("file://")
|
|
27
|
+
source?.uri?.startsWith("file://") ||
|
|
28
|
+
source?.uri?.startsWith("asset:/") ||
|
|
29
|
+
source?.uri?.startsWith("node_modules_");
|
|
28
30
|
|
|
29
31
|
export default function Image({
|
|
30
32
|
style,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
|
+
import { Image } from "react-native";
|
|
4
|
+
import AndroidImage from "../Image/Image.android";
|
|
5
|
+
|
|
6
|
+
jest.mock(
|
|
7
|
+
"@applicaster/zapp-react-native-ui-components/Components/Image",
|
|
8
|
+
() => ({
|
|
9
|
+
QBImage: require("react-native").Image,
|
|
10
|
+
})
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
jest.mock("../Image/hooks", () => ({
|
|
14
|
+
useImageSourceWithDefault: ({ uri }) => ({ uri }),
|
|
15
|
+
useCheckFailedUri: () => ({
|
|
16
|
+
appendFailedToLoadUri: jest.fn(),
|
|
17
|
+
isFailedToLoadUri: () => false,
|
|
18
|
+
}),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
jest.mock("../Image/hooks/useImageSize", () => ({
|
|
22
|
+
__esModule: true,
|
|
23
|
+
default: ({ source }) => source,
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
describe("Android MasterCell image sources", () => {
|
|
27
|
+
test.each([
|
|
28
|
+
"asset:/icons/play.png",
|
|
29
|
+
"node_modules_plugin_assets_play",
|
|
30
|
+
"https://example.com/play.png",
|
|
31
|
+
"data:image/png;base64,test",
|
|
32
|
+
"file:///images/play.png",
|
|
33
|
+
])("renders supported source %s", (uri) => {
|
|
34
|
+
const { UNSAFE_getByType } = render(<AndroidImage uri={uri} />);
|
|
35
|
+
|
|
36
|
+
expect(UNSAFE_getByType(Image).props.source).toEqual({ uri });
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test.each(["unsupported://play.png", "", undefined])(
|
|
40
|
+
"does not render unsupported source %s",
|
|
41
|
+
(uri) => {
|
|
42
|
+
const { UNSAFE_queryByType } = render(<AndroidImage uri={uri} />);
|
|
43
|
+
|
|
44
|
+
expect(UNSAFE_queryByType(Image)).toBeNull();
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "15.1.21
|
|
3
|
+
"version": "15.1.21",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "15.1.21
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "15.1.21
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "15.1.21
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "15.1.21
|
|
31
|
+
"@applicaster/applicaster-types": "15.1.21",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "15.1.21",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "15.1.21",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "15.1.21",
|
|
35
35
|
"fast-json-stable-stringify": "^2.1.0",
|
|
36
36
|
"promise": "^8.3.0",
|
|
37
37
|
"react-native-sortables": "1.7.1",
|