File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
demo/src/screens/componentScreens Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export default class OverlaysScreen extends Component {
1515 return (
1616 < View centerH >
1717 < Text dark10 > { text } </ Text >
18- < Image style = { styles . image } source = { image } overlayType = { type } customOverlayContent = { customOverylay } />
18+ < Image /* overlayColor={'red'} */ style = { styles . image } source = { image } overlayType = { type } customOverlayContent = { customOverylay } />
1919 </ View >
2020 ) ;
2121 } ;
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ class Image extends PureBaseComponent {
5050 * https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/OverlaysScreen.js
5151 */
5252 overlayType : Overlay . propTypes . type ,
53+ /**
54+ * Pass a custom color for the overlay
55+ */
56+ overlayColor : PropTypes . string ,
5357 /**
5458 * Render an overlay with custom content
5559 */
@@ -110,6 +114,7 @@ class Image extends PureBaseComponent {
110114 cover,
111115 aspectRatio,
112116 overlayType,
117+ overlayColor,
113118 customOverlayContent,
114119 ...others
115120 } = this . getThemeProps ( ) ;
@@ -132,7 +137,7 @@ class Image extends PureBaseComponent {
132137 source = { source }
133138 >
134139 { ( overlayType || customOverlayContent ) && (
135- < Overlay style = { style } type = { overlayType } customContent = { customOverlayContent } />
140+ < Overlay style = { style } type = { overlayType } color = { overlayColor } customContent = { customOverlayContent } />
136141 ) }
137142 </ ImageView >
138143 ) ;
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ export default class Overlay extends PureBaseComponent {
2727 * The type of overlay to set on top of the image
2828 */
2929 type : PropTypes . oneOf ( _ . values ( OVERLY_TYPES ) ) ,
30+ /**
31+ * The overlay color
32+ */
33+ color : PropTypes . string ,
3034 /**
3135 * Custom overlay content to be rendered on top of the image
3236 */
@@ -58,7 +62,8 @@ export default class Overlay extends PureBaseComponent {
5862 } ;
5963
6064 renderImage = ( style , source ) => {
61- return < Image style = { [ styles . container , style ] } resizeMode = { 'stretch' } source = { source } /> ;
65+ const { color} = this . props ;
66+ return < Image style = { [ styles . container , { tintColor : color } , style ] } resizeMode = { 'stretch' } source = { source } /> ;
6267 } ;
6368
6469 render ( ) {
You can’t perform that action at this time.
0 commit comments