Move Android's Image ViewConfig to JS

Reviewed By: sahrens

Differential Revision: D9492683

fbshipit-source-id: 035aa00650ee4908452fe18384d953882bc2a8d8
This commit is contained in:
Eli White
2018-08-23 21:35:16 -07:00
committed by Facebook Github Bot
parent daec505144
commit a700044e2e
3 changed files with 249 additions and 4 deletions

View File

@@ -18,16 +18,15 @@ const React = require('React');
const ReactNative = require('ReactNative');
const StyleSheet = require('StyleSheet');
const StyleSheetPropType = require('StyleSheetPropType');
const ImageViewNativeComponent = require('ImageViewNativeComponent');
const TextAncestor = require('TextAncestor');
const flattenStyle = require('flattenStyle');
const merge = require('merge');
const requireNativeComponent = require('requireNativeComponent');
const resolveAssetSource = require('resolveAssetSource');
const {ImageLoader} = NativeModules;
const RKImage = requireNativeComponent('RCTImageView');
const TextInlineImageNativeComponent = require('TextInlineImageNativeComponent');
import type {ImageProps as ImagePropsType} from 'ImageProps';
@@ -182,7 +181,7 @@ declare class ImageComponentType extends ReactNative.NativeComponent<
*/
let Image = (
props: ImagePropsType,
forwardedRef: ?React.Ref<'RCTTextInlineImage' | 'RKImage'>,
forwardedRef: ?React.Ref<'RCTTextInlineImage' | 'ImageViewNativeComponent'>,
) => {
let source = resolveAssetSource(props.source);
const defaultSource = resolveAssetSource(props.defaultSource);
@@ -252,7 +251,7 @@ let Image = (
hasTextAncestor ? (
<TextInlineImageNativeComponent {...nativeProps} />
) : (
<RKImage {...nativeProps} />
<ImageViewNativeComponent {...nativeProps} />
)
}
</TextAncestor.Consumer>