[fix] remove Image styles not supported by View

This commit is contained in:
Nicolas Gallagher
2017-07-09 17:47:19 -07:00
parent 66732394cb
commit d03e06632e
2 changed files with 9 additions and 1 deletions

View File

@@ -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"', () => {

View File

@@ -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