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 {
15
15
return (
16
16
< View centerH >
17
17
< 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 } />
19
19
</ View >
20
20
) ;
21
21
} ;
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ class Image extends PureBaseComponent {
50
50
* https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/OverlaysScreen.js
51
51
*/
52
52
overlayType : Overlay . propTypes . type ,
53
+ /**
54
+ * Pass a custom color for the overlay
55
+ */
56
+ overlayColor : PropTypes . string ,
53
57
/**
54
58
* Render an overlay with custom content
55
59
*/
@@ -110,6 +114,7 @@ class Image extends PureBaseComponent {
110
114
cover,
111
115
aspectRatio,
112
116
overlayType,
117
+ overlayColor,
113
118
customOverlayContent,
114
119
...others
115
120
} = this . getThemeProps ( ) ;
@@ -132,7 +137,7 @@ class Image extends PureBaseComponent {
132
137
source = { source }
133
138
>
134
139
{ ( overlayType || customOverlayContent ) && (
135
- < Overlay style = { style } type = { overlayType } customContent = { customOverlayContent } />
140
+ < Overlay style = { style } type = { overlayType } color = { overlayColor } customContent = { customOverlayContent } />
136
141
) }
137
142
</ ImageView >
138
143
) ;
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ export default class Overlay extends PureBaseComponent {
27
27
* The type of overlay to set on top of the image
28
28
*/
29
29
type : PropTypes . oneOf ( _ . values ( OVERLY_TYPES ) ) ,
30
+ /**
31
+ * The overlay color
32
+ */
33
+ color : PropTypes . string ,
30
34
/**
31
35
* Custom overlay content to be rendered on top of the image
32
36
*/
@@ -58,7 +62,8 @@ export default class Overlay extends PureBaseComponent {
58
62
} ;
59
63
60
64
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 } /> ;
62
67
} ;
63
68
64
69
render ( ) {
You can’t perform that action at this time.
0 commit comments