NativeImageLoaderIOS.js 863 B

1234567891011121314151617181920212223242526272829303132
  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. +getConstants: () => {||};
  15. // Return [width, height] of image uri
  16. +getSize: (uri: string) => Promise<$ReadOnlyArray<number>>;
  17. +getSizeWithHeaders: (
  18. uri: string,
  19. headers: Object,
  20. ) => Promise<{
  21. width: number,
  22. height: number,
  23. ...
  24. }>;
  25. +prefetchImage: (uri: string) => Promise<boolean>;
  26. +queryCache: (uris: Array<string>) => Promise<Object>;
  27. }
  28. export default (TurboModuleRegistry.getEnforcing<Spec>('ImageLoader'): Spec);