Skip to content

Commit bd5479f

Browse files
authored
CardImage - remove deprecated props (#1541)
* CardImage - removing deprecated props * remove import
1 parent 2937453 commit bd5479f

File tree

2 files changed

+5
-35
lines changed

2 files changed

+5
-35
lines changed
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import React from 'react';
2-
import { ImageSourcePropType } from 'react-native';
32
import { ImageProps } from '../image';
4-
export declare type CardImageProps = Omit<ImageProps, 'source'> & {
5-
/**
6-
* Image source, either remote source or local. Note: for remote pass object {uri: <remote_uri_string>}
7-
*/
8-
imageSource?: ImageSourcePropType;
9-
source?: ImageSourcePropType;
3+
export declare type CardImageProps = ImageProps & {
104
/**
115
* Image width
126
*/
@@ -21,10 +15,6 @@ export declare type CardImageProps = Omit<ImageProps, 'source'> & {
2115
* Card component
2216
*/
2317
position?: string[];
24-
/**
25-
* border radius, basically for Android since overflow doesn't work well (deprecated)
26-
*/
27-
borderRadius?: number;
2818
};
2919
declare const _default: React.ComponentType<CardImageProps>;
3020
export default _default;

src/components/card/CardImage.tsx

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
import React, {PureComponent} from 'react';
2-
import {View, StyleSheet, ImageSourcePropType} from 'react-native';
3-
import {LogService} from '../../services';
2+
import {View, StyleSheet} from 'react-native';
43
// import {BaseComponent} from '../../commons';
54
import Image, {ImageProps} from '../image';
65
import * as CardPresenter from './CardPresenter';
76
import asCardChild, {asCardChildProps} from './asCardChild';
87

98

10-
// TODO: Remove omitting source after imageSource deprecation (since it's required for Image)
11-
export type CardImageProps = Omit<ImageProps, 'source'> & {
12-
/**
13-
* Image source, either remote source or local. Note: for remote pass object {uri: <remote_uri_string>}
14-
*/
15-
imageSource?: ImageSourcePropType;
16-
source?: ImageSourcePropType; //TODO: Remove after imageSource deprecation - should take it from ImageProps
9+
export type CardImageProps = ImageProps & {
1710
/**
1811
* Image width
1912
*/
@@ -28,10 +21,6 @@ export type CardImageProps = Omit<ImageProps, 'source'> & {
2821
* Card component
2922
*/
3023
position?: string[];
31-
/**
32-
* border radius, basically for Android since overflow doesn't work well (deprecated)
33-
*/
34-
borderRadius?: number;
3524
};
3625

3726
type Props = CardImageProps & asCardChildProps;
@@ -49,32 +38,23 @@ class CardImage extends PureComponent<Props> {
4938
super(props);
5039

5140
this.styles = createStyles(props);
52-
53-
if (props.imageSource) {
54-
LogService.deprecationWarn({component: 'CardImage', oldProp: 'imageSource', newProp: 'source'});
55-
}
56-
if (props.borderRadius) {
57-
LogService.deprecationWarn({component: 'CardImage', oldProp: 'borderRadius'});
58-
}
5941
}
6042

6143
render() {
6244
const {
63-
imageSource,
6445
source,
6546
style,
6647
testID,
6748
overlayType,
6849
context: {borderStyle}
6950
} = this.props;
70-
const finalSource = source || imageSource;
7151

72-
if (finalSource) {
52+
if (source) {
7353
return (
7454
<View style={[this.styles.container, borderStyle, style]}>
7555
<Image
7656
testID={testID}
77-
source={finalSource}
57+
source={source}
7858
style={[this.styles.image]}
7959
overlayType={overlayType}
8060
/>

0 commit comments

Comments
 (0)