mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Handwritten view configs for Image
Summary: Hand writing view configs for NativeImageViewComponent so that it'll work in bridgeless mode and won't fall back to the UIManager. Changelog: [Internal] Reviewed By: ejanzer Differential Revision: D19217961 fbshipit-source-id: d5a123b35a75ba3e22c57b1dde18a47893681614
This commit is contained in:
committed by
Facebook Github Bot
parent
233fdfc014
commit
80cfa9c8ee
@@ -12,8 +12,6 @@
|
||||
|
||||
const requireNativeComponent = require('../ReactNative/requireNativeComponent');
|
||||
|
||||
import codegenNativeComponent from '../Utilities/codegenNativeComponent';
|
||||
|
||||
import type {DangerouslyImpreciseStyle} from '../StyleSheet/StyleSheet';
|
||||
import type {ResolvedAssetSource} from './AssetSourceResolver';
|
||||
import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
|
||||
@@ -22,6 +20,9 @@ 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,
|
||||
@@ -40,15 +41,15 @@ type NativeProps = $ReadOnly<{|
|
||||
|}>;
|
||||
|
||||
let ImageViewNativeComponent;
|
||||
|
||||
if (global.RN$Bridgeless) {
|
||||
ImageViewNativeComponent = codegenNativeComponent<NativeProps>(
|
||||
'RCTImageView',
|
||||
);
|
||||
ReactNativeViewConfigRegistry.register('RCTImageView', () => {
|
||||
return ImageViewViewConfig;
|
||||
});
|
||||
ImageViewNativeComponent = 'RCTImageView';
|
||||
} else {
|
||||
ImageViewNativeComponent = requireNativeComponent<NativeProps>(
|
||||
'RCTImageView',
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = (ImageViewNativeComponent: HostComponent<NativeProps>);
|
||||
export default ((ImageViewNativeComponent: any): HostComponent<NativeProps>); // flowlint-line unclear-type:off
|
||||
|
||||
Reference in New Issue
Block a user