mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-31 17:53:50 +00: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 }} />);
|
const component = render(<Image style={{ resizeMode: Image.resizeMode.contain }} />);
|
||||||
expect(component).toMatchSnapshot();
|
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"', () => {
|
test('prop "testID"', () => {
|
||||||
|
|||||||
@@ -184,8 +184,10 @@ class Image extends Component {
|
|||||||
this.context.isInAParentText && styles.inline,
|
this.context.isInAParentText && styles.inline,
|
||||||
backgroundImage && { backgroundImage }
|
backgroundImage && { backgroundImage }
|
||||||
]);
|
]);
|
||||||
// View doesn't support 'resizeMode' as a style
|
// View doesn't support these styles
|
||||||
|
delete style.overlayColor;
|
||||||
delete style.resizeMode;
|
delete style.resizeMode;
|
||||||
|
delete style.tintColor;
|
||||||
|
|
||||||
// Allows users to trigger the browser's image context menu
|
// Allows users to trigger the browser's image context menu
|
||||||
const hiddenImage = displayImage
|
const hiddenImage = displayImage
|
||||||
|
|||||||
Reference in New Issue
Block a user