From 7f9ec4e4c850765fe1eea75460412c959fad1f4b Mon Sep 17 00:00:00 2001 From: Jean Regisser Date: Mon, 27 Jun 2016 03:17:33 -0700 Subject: [PATCH] Fixed incorrect style props passed to Android Image when using children Summary: Hi there, Here is a fix for #7538 (and #5085). I had originally discovered this issue when using `resizeMode` through the style props. Although this might arguably be an incorrect usage (see https://github.com/facebook/react-native/issues/4759#issuecomment-164301166) the same issue would happen with the `tintColor` and `overlayColor` style props. To test this, you can render the following: ```jsx const imageContainerStyle = {width: 100, height: 100, backgroundColor: 'green', marginLeft: 10, marginTop: 10, }; const imageStyle = {flex: 1, width: undefined, height: undefined, resizeMode: 'contain', }; return ( !ViewStyleKeys.has(x))); + var Image = React.createClass({ propTypes: { ...View.propTypes, @@ -222,12 +228,15 @@ var Image = React.createClass({ if (nativeProps.children) { // TODO(6033040): Consider implementing this as a separate native component + const containerStyle = filterObject(style, (val, key) => !ImageSpecificStyleKeys.has(key)); + const imageStyle = filterObject(style, (val, key) => ImageSpecificStyleKeys.has(key)); const imageProps = merge(nativeProps, { - style: styles.absoluteImage, + style: [imageStyle, styles.absoluteImage], children: undefined, }); + return ( - + {this.props.children}