Skip to content

Commit ae5e043

Browse files
committed
Fix Card.Image crash on Android when passing position prop
1 parent 4ba6144 commit ae5e043

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

src/components/card/CardImage.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Image, {ImageProps} from '../image';
44
import * as CardPresenter from './CardPresenter';
55
import asCardChild, {asCardChildProps} from './asCardChild';
66

7-
87
export type CardImageProps = ImageProps & {
98
/**
109
* Image width
@@ -41,32 +40,24 @@ class CardImage extends PureComponent<Props> {
4140

4241
render() {
4342
const {
44-
source,
4543
style,
46-
testID,
47-
overlayType,
4844
context: {borderStyle},
45+
/* Note: Destruct position to avoid passing it to Image component cause it crashes Android (position is a saved prop) */
46+
// eslint-disable-next-line
47+
position,
4948
...others
5049
} = this.props;
5150

5251
return (
5352
<View style={[this.styles.container, borderStyle, style]}>
54-
<Image
55-
testID={testID}
56-
source={source}
57-
style={[this.styles.image]}
58-
overlayType={overlayType}
59-
{...others}
60-
/>
53+
<Image style={[this.styles.image]} {...others}/>
6154
</View>
62-
);
55+
);
6356
}
6457
}
6558

6659
function createStyles({width, height, context: {position}}: Props) {
67-
const {top, left, right, bottom} = CardPresenter.extractPositionValues(
68-
position
69-
);
60+
const {top, left, right, bottom} = CardPresenter.extractPositionValues(position);
7061
return StyleSheet.create({
7162
container: {
7263
height: left || right ? undefined : height,

0 commit comments

Comments
 (0)