Files
react-native/Libraries/Image/ImageViewNativeComponent.js
T
Nat Mote c40988cc22 Deploy Flow v0.116 to xplat
Summary: Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D19416307

fbshipit-source-id: 32767f24e5bfeb1912f7dd5527eb8c4db7a08a1a
2020-01-16 14:05:49 -08:00

57 lines
1.7 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict-local
*/
'use strict';
const requireNativeComponent = require('../ReactNative/requireNativeComponent');
import type {DangerouslyImpreciseStyle} from '../StyleSheet/StyleSheet';
import type {ResolvedAssetSource} from './AssetSourceResolver';
import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
import type {ImageProps} from './ImageProps';
import type {ViewProps} from '../Components/View/ViewPropTypes';
import type {ImageStyleProp} from '../StyleSheet/StyleSheet';
import type {ColorValue} from '../StyleSheet/StyleSheetTypes';
import ImageViewViewConfig from './ImageViewViewConfig';
const ReactNativeViewConfigRegistry = require('../Renderer/shims/ReactNativeViewConfigRegistry');
type NativeProps = $ReadOnly<{|
...ImageProps,
...ViewProps,
style?: ImageStyleProp | DangerouslyImpreciseStyle,
// iOS native props
tintColor?: ColorValue,
// Android native props
shouldNotifyLoadEvents?: boolean,
src?: ?ResolvedAssetSource | $ReadOnlyArray<{uri: string, ...}>,
headers?: ?string,
defaultSrc?: ?string,
loadingIndicatorSrc?: ?string,
|}>;
let ImageViewNativeComponent;
if (global.RN$Bridgeless) {
ReactNativeViewConfigRegistry.register('RCTImageView', () => {
return ImageViewViewConfig;
});
ImageViewNativeComponent = 'RCTImageView';
} else {
ImageViewNativeComponent = requireNativeComponent<NativeProps>(
'RCTImageView',
);
}
// flowlint-next-line unclear-type:off
export default ((ImageViewNativeComponent: any): HostComponent<NativeProps>);