Files
react-native/Libraries/Image/TextInlineImageNativeComponent.js
T
Danilo Bürger 6bdcb49966 Align android image style / source logic with ios (#34655)
Summary:
This aligns the logic of setting style (width / height) and source of Android with iOS.
iOS handles nullish uris with set width and heigth by passing them through. Android did not.

## Changelog

[Android] [Fixed] - Align android image style / source logic with ios

Pull Request resolved: https://github.com/facebook/react-native/pull/34655

Test Plan:
```
<Image source={{width: 100, height: 100}} />
```

Before this Patch:
* iOS: Renders a blank image with 100x100
* Android: Renders a blank image with 0x0

After this Patch:
* iOS: Renders a blank image with 100x100
* Android: Renders a blank image with 100x100

Reviewed By: sammy-SC

Differential Revision: D39423391

Pulled By: cipolleschi

fbshipit-source-id: 997c06dea42e9b69fda12b678a1b82ad8319537f
2022-09-13 05:18:45 -07:00

51 lines
1.3 KiB
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and 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';
import type {
HostComponent,
PartialViewConfig,
} from '../Renderer/shims/ReactNativeTypes';
import type {ViewProps} from '../Components/View/ViewPropTypes';
import type {ImageResizeMode} from './ImageResizeMode';
import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry';
import type {ColorValue} from '../StyleSheet/StyleSheet';
type NativeProps = $ReadOnly<{
...ViewProps,
resizeMode?: ?ImageResizeMode,
src?: ?$ReadOnlyArray<?$ReadOnly<{uri?: ?string, ...}>>,
tintColor?: ?ColorValue,
headers?: ?{[string]: string},
}>;
export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
uiViewClassName: 'RCTTextInlineImage',
bubblingEventTypes: {},
directEventTypes: {},
validAttributes: {
resizeMode: true,
src: true,
tintColor: {
process: require('../StyleSheet/processColor'),
},
headers: true,
},
};
const TextInlineImage: HostComponent<NativeProps> =
NativeComponentRegistry.get<NativeProps>(
'RCTTextInlineImage',
() => __INTERNAL_VIEW_CONFIG,
);
export default TextInlineImage;