Skip to content

Commit 9ac219e

Browse files
zhongwuzwfacebook-github-bot
authored andcommitted
fix getter of result from Image query cache (facebook#23602)
Summary: We assume `map` is the type of `Map`, but actually it's not, so we would get type error. [iOS] [Fixed] - [RNTester] fix getter of result from Image query cache Pull Request resolved: facebook#23602 Differential Revision: D14221747 Pulled By: cpojer fbshipit-source-id: 06cf08078a330e4d5731ad72010c87e9e69fcd7b
1 parent 9a64755 commit 9ac219e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Libraries/Image/Image.android.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ function abortPrefetch(requestId: number) {
157157
*/
158158
async function queryCache(
159159
urls: Array<string>,
160-
): Promise<Map<string, 'memory' | 'disk'>> {
160+
): Promise<{[string]: 'memory' | 'disk' | 'disk/memory'}> {
161161
return await ImageLoader.queryCache(urls);
162162
}
163163

Libraries/Image/Image.ios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function prefetch(url: string) {
4848

4949
async function queryCache(
5050
urls: Array<string>,
51-
): Promise<Map<string, 'memory' | 'disk' | 'disk/memory'>> {
51+
): Promise<{[string]: 'memory' | 'disk' | 'disk/memory'}> {
5252
return await ImageViewManager.queryCache(urls);
5353
}
5454

RNTester/js/ImageExample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class NetworkImageCallbackExample extends React.Component<
9393
`✔ Prefetch OK (+${new Date() - mountTime}ms)`,
9494
);
9595
Image.queryCache([IMAGE_PREFETCH_URL]).then(map => {
96-
const result = map.get(IMAGE_PREFETCH_URL);
96+
const result = map[IMAGE_PREFETCH_URL];
9797
if (result) {
9898
this._loadEventFired(
9999
`✔ queryCache "${result}" (+${new Date() -

0 commit comments

Comments
 (0)