Skip to content

Commit 9bb4ac7

Browse files
committed
Image - omit props that shouldn't be forwarded
1 parent 4c53413 commit 9bb4ac7

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/components/Image/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import {Image as RNImage} from 'react-native';
33
import {withOnyx} from 'react-native-onyx';
44
import lodashGet from 'lodash/get';
5+
import _ from 'underscore';
56
import ONYXKEYS from '../../ONYXKEYS';
67
import {defaultProps, imagePropTypes} from './imagePropTypes';
78
import RESIZE_MODES from './resizeModes';
@@ -55,12 +56,12 @@ class Image extends React.Component {
5556
}
5657

5758
render() {
58-
// eslint-disable-next-line
59-
const { source, onLoad, ...rest } = this.props;
60-
const imageSource = this.getImageSource();
59+
// Omit the props which the underlying RNImage won't use
60+
const forwardedProps = _.omit(this.props, ['source', 'onLoad', 'session', 'isAuthTokenRequired']);
61+
const source = this.getImageSource();
6162

62-
// eslint-disable-next-line
63-
return <RNImage {...rest} source={imageSource} />;
63+
// eslint-disable-next-line react/jsx-props-no-spreading
64+
return <RNImage {...forwardedProps} source={source} />;
6465
}
6566
}
6667

0 commit comments

Comments
 (0)