Skip to content

Commit 75b2599

Browse files
authored
StateScreen - remove deprecated props: 'source' (use 'imageSource'), 'testId' (use RN's 'testID'). (#1553)
1 parent 2157de6 commit 75b2599

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

src/components/stateScreen/index.tsx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import _ from 'lodash';
22
import React, {Component} from 'react';
33
import {StyleSheet} from 'react-native';
4-
import {LogService} from '../../services';
54
import {Constants} from '../../helpers';
65
import {Typography, Colors} from '../../style';
76
import {asBaseComponent} from '../../commons/new';
@@ -11,40 +10,30 @@ import Button from '../../components/button';
1110
import Text from '../../components/text';
1211
import {StateScreenProps} from './types';
1312

13+
1414
class StateScreen extends Component<StateScreenProps> {
1515
static displayName = 'StateScreen';
1616

1717
styles: any;
1818
constructor(props: StateScreenProps) {
1919
super(props);
20-
21-
if (props.testId) {
22-
LogService.deprecationWarn({component: 'StateScreen', oldProp: 'testId', newProp: 'testID'});
23-
24-
}
25-
if (props.source) {
26-
LogService.deprecationWarn({component: 'StateScreen', oldProp: 'source', newProp: 'imageSource'});
27-
}
2820

2921
this.generateStyles();
3022
}
3123

3224
generateStyles() {
33-
const {source, imageSource} = this.props;
34-
const finalSource = imageSource || source;
25+
const {imageSource} = this.props;
3526

36-
const isRemoteImage = _.isObject(finalSource) && Boolean(finalSource.uri);
27+
const isRemoteImage = _.isObject(imageSource) && Boolean(imageSource.uri);
3728
this.styles = createStyles(isRemoteImage);
3829
}
3930

4031
render() {
41-
// TODO: remove testId and source after deprecation
42-
const {title, subtitle, source, imageSource, ctaLabel, onCtaPress, testId, testID} = this.props;
43-
const finalSource = imageSource || source;
32+
const {title, subtitle, imageSource, ctaLabel, onCtaPress, testID} = this.props;
4433

4534
return (
46-
<View style={this.styles.container} testID={testID || testId}>
47-
<Image style={this.styles.image} resizeMode={'contain'} source={finalSource}/>
35+
<View style={this.styles.container} testID={testID}>
36+
<Image style={this.styles.image} resizeMode={'contain'} source={imageSource}/>
4837
<Text style={[this.styles.title]}>{title}</Text>
4938
<Text style={[this.styles.subtitle]}>{subtitle}</Text>
5039
<Button

0 commit comments

Comments
 (0)