NativeImageLoaderAndroid.js 954 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @flow
  8. * @format
  9. */
  10. 'use strict';
  11. import type {TurboModule} from '../TurboModule/RCTExport';
  12. import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
  13. export interface Spec extends TurboModule {
  14. +abortRequest: (requestId: number) => void;
  15. +getConstants: () => {||};
  16. +getSize: (
  17. uri: string,
  18. ) => Promise<
  19. $ReadOnly<{
  20. width: number,
  21. height: number,
  22. ...
  23. }>,
  24. >;
  25. +getSizeWithHeaders: (
  26. uri: string,
  27. headers: Object,
  28. ) => Promise<{
  29. width: number,
  30. height: number,
  31. ...
  32. }>;
  33. +prefetchImage: (uri: string, requestId: number) => Promise<boolean>;
  34. +queryCache: (uris: Array<string>) => Promise<Object>;
  35. }
  36. export default (TurboModuleRegistry.getEnforcing<Spec>('ImageLoader'): Spec);