fix getter of result from Image query cache (#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: https://github.com/facebook/react-native/pull/23602

Differential Revision: D14221747

Pulled By: cpojer

fbshipit-source-id: 06cf08078a330e4d5731ad72010c87e9e69fcd7b
This commit is contained in:
zhongwuzw
2019-02-25 20:31:42 -08:00
committed by Facebook Github Bot
parent 9a64755a18
commit 9ac219e077
3 changed files with 3 additions and 3 deletions

View File

@@ -157,7 +157,7 @@ function abortPrefetch(requestId: number) {
*/
async function queryCache(
urls: Array<string>,
): Promise<Map<string, 'memory' | 'disk'>> {
): Promise<{[string]: 'memory' | 'disk' | 'disk/memory'}> {
return await ImageLoader.queryCache(urls);
}

View File

@@ -48,7 +48,7 @@ function prefetch(url: string) {
async function queryCache(
urls: Array<string>,
): Promise<Map<string, 'memory' | 'disk' | 'disk/memory'>> {
): Promise<{[string]: 'memory' | 'disk' | 'disk/memory'}> {
return await ImageViewManager.queryCache(urls);
}

View File

@@ -93,7 +93,7 @@ class NetworkImageCallbackExample extends React.Component<
`✔ Prefetch OK (+${new Date() - mountTime}ms)`,
);
Image.queryCache([IMAGE_PREFETCH_URL]).then(map => {
const result = map.get(IMAGE_PREFETCH_URL);
const result = map[IMAGE_PREFETCH_URL];
if (result) {
this._loadEventFired(
`✔ queryCache "${result}" (+${new Date() -