RN: Improve `nativeImageSource` Return Type

Summary: Now that `ImageURISource` is a proper type, `nativeImageSource`'s return type should simply use that instead of being an untyped `Object`.

Reviewed By: cpojer

Differential Revision: D17246527

fbshipit-source-id: 6ec0c80a93b8794e6c243154875e3560ddacbc59
This commit is contained in:
Tim Yung 2019-09-09 14:56:32 -07:00 коммит произвёл Facebook Github Bot
Родитель 1c2671c8c9
Коммит 8924639613
1 изменённых файлов: 10 добавлений и 16 удалений

Просмотреть файл

@ -10,26 +10,20 @@
'use strict';
const Platform = require('../Utilities/Platform');
import Platform from '../Utilities/Platform';
// TODO: Change `nativeImageSource` to return this type.
export type NativeImageSource = {|
+deprecated: true,
+height: number,
+uri: string,
+width: number,
|};
import type {ImageURISource} from './ImageSource';
type NativeImageSourceSpec = {|
+android?: string,
+ios?: string,
+default?: string,
type NativeImageSourceSpec = $ReadOnly<{|
android?: string,
ios?: string,
default?: string,
// For more details on width and height, see
// http://facebook.github.io/react-native/docs/images.html#why-not-automatically-size-everything
+height: number,
+width: number,
|};
height: number,
width: number,
|}>;
/**
* In hybrid apps, use `nativeImageSource` to access images that are already
@ -47,7 +41,7 @@ type NativeImageSourceSpec = {|
* http://facebook.github.io/react-native/docs/images.html
*
*/
function nativeImageSource(spec: NativeImageSourceSpec): Object {
function nativeImageSource(spec: NativeImageSourceSpec): ImageURISource {
let uri = Platform.select({
android: spec.android,
default: spec.default,