@amazon-devices/expo-image 2.0.1758683737 → 2.0.9000000000

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.
@@ -1,24 +1,4 @@
1
1
  License from package.json:
2
2
  ==============================
3
3
 
4
- The MIT License (MIT)
5
-
6
- Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in all
16
- copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- SOFTWARE.
4
+ MIT
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoImage.d.ts","sourceRoot":"","sources":["../src/ExpoImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAsC,MAAM,cAAc,CAAC;AAExF,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,eAAe,CAAC;AAIvB,QAAA,MAAM,eAAe,KAAmC,CAAC;AAgBzD,cAAM,SAAU,SAAQ,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC;IAC3D,WAAW,aAET;IAEF,MAAM,UAAW,oBAAoB,CAAC,kBAAkB,CAAC,UAGvD;IAEF,UAAU,UAAW,oBAAoB,CAAC,sBAAsB,CAAC,UAE/D;IAEF,OAAO,UAAW,oBAAoB,CAAC,mBAAmB,CAAC,UAGzD;IAEF,SAAS,aAEP;IAEF,MAAM;CA+DP;AAED,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"ExpoImage.d.ts","sourceRoot":"","sources":["../src/ExpoImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAsC,MAAM,cAAc,CAAC;AAExF,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,eAAe,CAAC;AAIvB,QAAA,MAAM,eAAe,KAAmC,CAAC;AAgBzD,cAAM,SAAU,SAAQ,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC;IAC3D,WAAW,aAET;IAEF,MAAM,GAAI,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,UAGvD;IAEF,UAAU,GAAI,OAAO,oBAAoB,CAAC,sBAAsB,CAAC,UAE/D;IAEF,OAAO,GAAI,OAAO,oBAAoB,CAAC,mBAAmB,CAAC,UAGzD;IAEF,SAAS,aAEP;IAEF,MAAM;CA+DP;AAED,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoImage.kepler.d.ts","sourceRoot":"","sources":["../src/ExpoImage.kepler.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAuC,MAAM,cAAc,CAAC;AAEzF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,eAAe,CAAC;AAyBvB,cAAM,SAAU,SAAQ,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC;IAC3D,WAAW,aAET;IAEF,MAAM,UAAW,oBAAoB,CAAC,kBAAkB,CAAC,UAEvD;IAEF,UAAU,UAAW,oBAAoB,CAAC,sBAAsB,CAAC,UAE/D;IAEF,OAAO,UAAW,oBAAoB,CAAC,mBAAmB,CAAC,UAEzD;IAEF,SAAS,aAEP;IAEF,MAAM;CAmDP;AAED,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"ExpoImage.kepler.d.ts","sourceRoot":"","sources":["../src/ExpoImage.kepler.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAuC,MAAM,cAAc,CAAC;AAEzF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,eAAe,CAAC;AAyBvB,cAAM,SAAU,SAAQ,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC;IAC3D,WAAW,aAET;IAEF,MAAM,GAAI,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,UAEvD;IAEF,UAAU,GAAI,OAAO,oBAAoB,CAAC,sBAAsB,CAAC,UAE/D;IAEF,OAAO,GAAI,OAAO,oBAAoB,CAAC,mBAAmB,CAAC,UAEzD;IAEF,SAAS,aAEP;IAEF,MAAM;CAmDP;AAED,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"base83.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/base83.ts"],"names":[],"mappings":"AAsFA,eAAO,MAAM,QAAQ,QAAS,MAAM,WAQnC,CAAC;AAEF,eAAO,MAAM,QAAQ,MAAO,MAAM,UAAU,MAAM,KAAG,MAOpD,CAAC"}
1
+ {"version":3,"file":"base83.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/base83.ts"],"names":[],"mappings":"AAsFA,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,WAQnC,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,EAAE,QAAQ,MAAM,KAAG,MAOpD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/decode.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,eAAe,aAAc,MAAM,KAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAQzF,CAAC;AAuBF,QAAA,MAAM,MAAM,aAAc,MAAM,SAAS,MAAM,UAAU,MAAM,UAAU,MAAM,mCAsD9E,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/decode.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,KAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAQzF,CAAC;AAuBF,QAAA,MAAM,MAAM,GAAI,UAAU,MAAM,EAAE,OAAO,MAAM,EAAE,QAAQ,MAAM,EAAE,QAAQ,MAAM,mCAsD9E,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,UAAW,MAAM,WAOzC,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,MAAM,WAOzC,CAAC;AAEF,eAAO,MAAM,IAAI,MAAO,MAAM,WAAqB,CAAC;AAEpD,eAAO,MAAM,OAAO,QAAS,MAAM,OAAO,MAAM,WAA6C,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,WAOzC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,WAOzC,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,WAAqB,CAAC;AAEpD,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,WAA6C,CAAC"}
@@ -1,14 +1,28 @@
1
+ /*
2
+ * Copyright (c) 2024-2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * PROPRIETARY/CONFIDENTIAL
5
+ *
6
+ * Use is subject to license terms.
7
+ */
8
+
1
9
  #include "../ExpoImageComponent.h"
2
10
 
3
11
  #include <KeplerScript/utils/image/KeplerScriptImageCacheHandler.h>
12
+ #include <Volta/graphics/Picture.h>
13
+ #include <Volta/graphics/Recorder.h>
4
14
  #include <gmock/gmock-actions.h>
5
15
  #include <gmock/gmock.h>
16
+ #include <graphics/Canvas.h>
6
17
  #include <gtest/gtest.h>
7
18
 
19
+ #include <cstddef>
20
+
8
21
  #include "catch.hpp"
9
22
 
10
23
  class MockImageLoaderDelegate : public volta::IImageLoaderDelegate {
11
24
  public:
25
+ // NOLINTBEGIN(misc-non-private-member-variables-in-classes)
12
26
  MOCK_METHOD(void, notifyImageLoadStart, (), (override));
13
27
  MOCK_METHOD(void, notifyImageLoadProgress, (float progress), (override));
14
28
  MOCK_METHOD(void, notifyImageLoadSuccess, (volta::graphics::Image image), (override));
@@ -27,9 +41,10 @@ public:
27
41
  MOCK_METHOD(void, notifyImageLoadCancelled, (), (override));
28
42
  MOCK_METHOD(void, notifyImagePrefetchFailure, (volta::ImageLoadError error), (override));
29
43
  MOCK_METHOD(void, notifyImagePrefetchComplete, (), (override));
44
+ // NOLINTEND(misc-non-private-member-variables-in-classes)
30
45
  };
31
46
 
32
- std::unique_ptr<volta::graphics::Image> mockImage(int width, int height) {
47
+ std::unique_ptr<volta::graphics::Image> mockImage(int64_t width, int64_t height) {
33
48
  auto data = std::make_unique<uint8_t[]>(height * width * 4);
34
49
  return volta::graphics::Image::makeRasterImage(
35
50
  volta::graphics::Size{static_cast<float>(width), static_cast<float>(height)},
@@ -48,13 +63,11 @@ public:
48
63
  image_ = mockImage(width, height);
49
64
  }
50
65
 
51
- void load() override {
52
- return;
53
- }
66
+ void load() override {}
54
67
  bool isLoaded() override {
55
68
  return true;
56
69
  }
57
- volta::graphics::Image* getImage() {
70
+ volta::graphics::Image* getImage() override {
58
71
  return image_.get();
59
72
  }
60
73
 
@@ -62,9 +75,9 @@ private:
62
75
  std::unique_ptr<volta::graphics::Image> image_;
63
76
  };
64
77
 
78
+ // NOLINTNEXTLINE - warnings caused by catch2 macro internal implementation
65
79
  TEST_CASE("ExpoImageDrawableLayer") {
66
80
  ExpoImageDrawableLayer layer;
67
- volta::graphics::Canvas canvas;
68
81
  auto mockImg = mockImage(100, 100);
69
82
 
70
83
  SECTION("setSize") {
@@ -74,64 +87,65 @@ TEST_CASE("ExpoImageDrawableLayer") {
74
87
  EXPECT_EQ(layer.size_, size);
75
88
  }
76
89
 
77
- // TODO: PROJVEGA-211833 - Fix these test cases - removing volta::graphics::Canvas mocks
78
- // SECTION("onDraw") {
79
- // facebook::react::ImageSource source;
80
- // auto delegate = std::make_shared<MockImageLoaderDelegate>();
81
- // auto clipRect = volta::graphics::Rect{0.f, 0.f, 50.f, 50.f};
90
+ SECTION("onDraw") {
91
+ auto canvas = volta::graphics::Canvas::makeTestingCanvas();
92
+
93
+ facebook::react::ImageSource source;
94
+ auto delegate = std::make_shared<MockImageLoaderDelegate>();
95
+ auto clipRect = volta::graphics::Rect{0.f, 0.f, 50.f, 50.f};
96
+
97
+ layer.imageWrapper_ = std::make_shared<MockImageWrapper>(100, 100, source, delegate);
98
+ layer.setSize({50.f, 50.f});
99
+ layer.onDraw(canvas);
100
+ }
82
101
 
83
- // EXPECT_CALL(canvas, drawImageRect2(testing::_, testing::_, testing::_, testing::_)).Times(1);
84
- // EXPECT_CALL(canvas, clipRect(clipRect, testing::_, testing::_)).Times(1);
102
+ SECTION("paintImageWithContentFit cover") {
103
+ auto canvas = volta::graphics::Canvas::makeTestingCanvas();
85
104
 
86
- // layer.imageWrapper_ = std::make_shared<MockImageWrapper>(100, 100, source, delegate);
87
- // layer.setSize({50.f, 50.f});
88
- // layer.onDraw(canvas);
89
- // }
105
+ volta::graphics::Rect rect{-50.f, -50.f, 50.f, 50.f};
90
106
 
91
- // SECTION("paintImageWithContentFit cover") {
92
- // volta::graphics::Rect rect{-50.f, -50.f, 50.f, 50.f};
93
- // EXPECT_CALL(canvas, drawImageRect2(testing::_, rect, testing::_, testing::_)).Times(1);
107
+ layer.paintImageWithContentFit(*mockImg, canvas, volta::graphics::Paint(), ImageContentFit::Cover, false);
108
+ }
94
109
 
95
- // layer.paintImageWithContentFit(*mockImg, canvas, volta::graphics::Paint(), ImageContentFit::Cover, false);
96
- // }
110
+ SECTION("paintImageWithContentFit contain") {
111
+ auto canvas = volta::graphics::Canvas::makeTestingCanvas();
97
112
 
98
- // SECTION("paintImageWithContentFit contain") {
99
- // volta::graphics::Rect rect{50.f, 0.f, 150.f, 100.f};
113
+ volta::graphics::Rect rect{50.f, 0.f, 150.f, 100.f};
100
114
 
101
- // layer.setSize({200.f, 100.f});
102
- // EXPECT_CALL(canvas, drawImageRect2(testing::_, rect, testing::_, testing::_)).Times(1);
115
+ layer.setSize({200.f, 100.f});
103
116
 
104
- // layer.paintImageWithContentFit(*mockImg, canvas, volta::graphics::Paint(), ImageContentFit::Contain, false);
105
- // }
117
+ layer.paintImageWithContentFit(*mockImg, canvas, volta::graphics::Paint(), ImageContentFit::Contain, false);
118
+ }
106
119
 
107
- // SECTION("paintImageWithContentFit fill") {
108
- // volta::graphics::Rect rect{0.f, 0.f, 200.f, 100.f};
120
+ SECTION("paintImageWithContentFit fill") {
121
+ auto canvas = volta::graphics::Canvas::makeTestingCanvas();
122
+ volta::graphics::Rect rect{0.f, 0.f, 200.f, 100.f};
109
123
 
110
- // layer.setSize({200.f, 100.f});
111
- // EXPECT_CALL(canvas, drawImageRect2(testing::_, rect, testing::_, testing::_)).Times(1);
124
+ layer.setSize({200.f, 100.f});
112
125
 
113
- // layer.paintImageWithContentFit(*mockImg, canvas, volta::graphics::Paint(), ImageContentFit::Fill, false);
114
- // }
126
+ layer.paintImageWithContentFit(*mockImg, canvas, volta::graphics::Paint(), ImageContentFit::Fill, false);
127
+ }
115
128
 
116
- // SECTION("paintImageWithContentFit none") {
117
- // volta::graphics::Rect rect{-25.f, -25.f, 75.f, 75.f};
129
+ SECTION("paintImageWithContentFit none") {
130
+ auto canvas = volta::graphics::Canvas::makeTestingCanvas();
131
+ volta::graphics::Rect rect{-25.f, -25.f, 75.f, 75.f};
118
132
 
119
- // layer.setSize({50.f, 50.f});
120
- // EXPECT_CALL(canvas, drawImageRect2(testing::_, rect, testing::_, testing::_)).Times(1);
133
+ layer.setSize({50.f, 50.f});
121
134
 
122
- // layer.paintImageWithContentFit(*mockImg, canvas, volta::graphics::Paint(), ImageContentFit::None, false);
123
- // }
135
+ layer.paintImageWithContentFit(*mockImg, canvas, volta::graphics::Paint(), ImageContentFit::None, false);
136
+ }
124
137
 
125
- // SECTION("paintImageWithContentFit scaleDown") {
126
- // volta::graphics::Rect rect{-25.f, -25.f, 75.f, 75.f};
138
+ SECTION("paintImageWithContentFit scaleDown") {
139
+ auto canvas = volta::graphics::Canvas::makeTestingCanvas();
140
+ volta::graphics::Rect rect{-25.f, -25.f, 75.f, 75.f};
127
141
 
128
- // layer.setSize({50.f, 50.f});
129
- // EXPECT_CALL(canvas, drawImageRect2(testing::_, rect, testing::_, testing::_)).Times(1);
142
+ layer.setSize({50.f, 50.f});
130
143
 
131
- // layer.paintImageWithContentFit(*mockImg, canvas, volta::graphics::Paint(), ImageContentFit::ScaleDown, false);
132
- // }
144
+ layer.paintImageWithContentFit(*mockImg, canvas, volta::graphics::Paint(), ImageContentFit::ScaleDown, false);
145
+ }
133
146
  }
134
147
 
148
+ // NOLINTNEXTLINE - warnings caused by catch2 macro internal implementation
135
149
  TEST_CASE("ExpoImageComponent") {
136
150
  auto handler = std::make_shared<volta::react::KeplerScriptImageCacheHandler>();
137
151
  ExpoImageComponent component(handler);
@@ -1,8 +1,6 @@
1
1
  {
2
2
  "versions": {
3
3
  "2.0.0": "/com.amazon.kepler.expo_image_2@IExpoImage_0",
4
- "2.0.1756403551": "/com.amazon.kepler.expo_image_2@IExpoImage_0",
5
- "2.0.1758654000": "/com.amazon.kepler.expo_image_2@IExpoImage_0",
6
- "2.0.1758683737": "/com.amazon.kepler.expo_image_2@IExpoImage_0"
4
+ "2.0.9000000000": "/com.amazon.kepler.expo_image_2@IExpoImage_0"
7
5
  }
8
6
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@amazon-devices/expo-image", "title": "Expo Image", "version": "2.0.1758683737+1.6.0", "description": "A cross-platform, performant image component for React Native and Expo with Web support", "main": "build/index.js", "types": "build/index.d.ts", "sideEffects": false, "scripts": {"build": "expo-module build", "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", "expo-module": "expo-module"}, "homepage": "https://docs.expo.dev/versions/latest/sdk/image/", "repository": {"type": "git", "url": "https://github.com/expo/expo.git", "directory": "packages/expo-image"}, "kepler": {"temporary-alias-for-package": {"name": "expo-image", "version": "1.6.0"}}, "keywords": ["react-native"], "author": "650 Industries, Inc.", "license": "See license in LICENSE", "dependencies": {"@amazon-devices/keplerscript-turbomodule-api": "^1.0.0"}, "devDependencies": {"expo-module-scripts": "^3.0.0"}, "peerDependencies": {"expo": "*"}}
1
+ {"name": "@amazon-devices/expo-image", "title": "Expo Image", "version": "2.0.9000000000+1.6.0", "description": "A cross-platform, performant image component for React Native and Expo with Web support", "main": "build/index.js", "types": "build/index.d.ts", "sideEffects": false, "scripts": {"build": "expo-module build", "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module"}, "homepage": "https://docs.expo.dev/versions/latest/sdk/image/", "repository": {"type": "git", "url": "https://github.com/expo/expo.git", "directory": "packages/expo-image"}, "kepler": {"temporary-alias-for-package": {"name": "expo-image", "version": "1.6.0"}}, "keywords": ["react-native"], "author": "650 Industries, Inc.", "license": "See license in LICENSE", "dependencies": {"@amazon-devices/keplerscript-turbomodule-api": "^1.0.0"}, "devDependencies": {"expo-module-scripts": "^3.0.0"}, "peerDependencies": {"expo": "*"}}