mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-05-13 02:02:18 +08:00
[fix] remove Image styles not supported by View
This commit is contained in:
@@ -139,6 +139,12 @@ describe('components/Image', () => {
|
||||
const component = render(<Image style={{ resizeMode: Image.resizeMode.contain }} />);
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('removes other unsupported View styles', () => {
|
||||
const component = shallow(<Image style={{ overlayColor: 'red', tintColor: 'blue' }} />);
|
||||
expect(component.props().style.overlayColor).toBeUndefined();
|
||||
expect(component.props().style.tintColor).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
test('prop "testID"', () => {
|
||||
|
||||
@@ -184,8 +184,10 @@ class Image extends Component {
|
||||
this.context.isInAParentText && styles.inline,
|
||||
backgroundImage && { backgroundImage }
|
||||
]);
|
||||
// View doesn't support 'resizeMode' as a style
|
||||
// View doesn't support these styles
|
||||
delete style.overlayColor;
|
||||
delete style.resizeMode;
|
||||
delete style.tintColor;
|
||||
|
||||
// Allows users to trigger the browser's image context menu
|
||||
const hiddenImage = displayImage
|
||||
|
||||
Reference in New Issue
Block a user