Skip to content

Commit b3d3745

Browse files
authored
Fix/imageSource deprecation (#1115)
* Fix deprecation of 'imageSource' prop in CardSection and StateScreen components. * edit comments
1 parent b5fefd2 commit b3d3745

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/components/card/CardSection.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export type CardSectionProps = ViewProps & {
3636
* Will be used for the background when provided
3737
*/
3838
imageSource?: ImageSourcePropType;
39-
source?: ImageSourcePropType;
39+
source?: ImageSourcePropType; // TODO: remove after deprecation
4040
/**
4141
* The style for the background image
4242
*/
@@ -60,7 +60,7 @@ class CardSection extends PureComponent<Props> {
6060
super(props);
6161

6262
if (props.imageSource) {
63-
LogService.deprecationWarn({component: 'CardSection', oldProp: 'imageSource', newProp: 'source'});
63+
LogService.deprecationWarn({component: 'CardSection', oldProp: 'source', newProp: 'imageSource'});
6464
}
6565
}
6666

@@ -89,7 +89,7 @@ class CardSection extends PureComponent<Props> {
8989

9090
renderImage = () => {
9191
const {source, imageSource, imageStyle, imageProps, testID} = this.props;
92-
const finalSource = source || imageSource;
92+
const finalSource = imageSource || source;
9393

9494
// not actually needed, instead of adding ts-ignore
9595
if (finalSource) {
@@ -113,7 +113,7 @@ class CardSection extends PureComponent<Props> {
113113
style,
114114
...others
115115
} = this.props;
116-
const finalSource = source || imageSource;
116+
const finalSource = imageSource || source;
117117

118118
return (
119119
<View style={[styles.container, borderStyle, style]} {...others}>

src/components/stateScreen/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class StateScreen extends BaseComponent {
2323
* The image source that's showing at the top. use an image that was required locally
2424
*/
2525
imageSource: PropTypes.oneOfType([PropTypes.object, PropTypes.number]),
26-
source: PropTypes.oneOfType([PropTypes.object, PropTypes.number]),
26+
source: PropTypes.oneOfType([PropTypes.object, PropTypes.number]), // TODO: remove after deprecation
2727
/**
2828
* To to show as the title
2929
*/
@@ -54,13 +54,13 @@ export default class StateScreen extends BaseComponent {
5454

5555
}
5656
if (props.imageSource) {
57-
LogService.deprecationWarn({component: 'StateScreen', oldProp: 'imageSource', newProp: 'source'});
57+
LogService.deprecationWarn({component: 'StateScreen', oldProp: 'source', newProp: 'imageSource'});
5858
}
5959
}
6060

6161
generateStyles() {
6262
const {source, imageSource} = this.props;
63-
const finalSource = source || imageSource;
63+
const finalSource = imageSource || source;
6464

6565
const isRemoteImage = _.isObject(finalSource) && Boolean(finalSource.uri);
6666
this.styles = createStyles(isRemoteImage);
@@ -69,7 +69,7 @@ export default class StateScreen extends BaseComponent {
6969
render() {
7070
// TODO: remove testId and imageSource after deprecation
7171
const {title, subtitle, source, imageSource, ctaLabel, onCtaPress, testId, testID} = this.props;
72-
const finalSource = source || imageSource;
72+
const finalSource = imageSource || source;
7373

7474
return (
7575
<View style={this.styles.container} testID={testID || testId}>

0 commit comments

Comments
 (0)