Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Remove Avatar platform specific code #15663

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Image - omit props that shouldn't be forwarded
kidroca committed Mar 23, 2023
commit 9bb4ac7c0e394c490800ee13b777ac3f5542325d
11 changes: 6 additions & 5 deletions src/components/Image/index.js
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import React from 'react';
import {Image as RNImage} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import lodashGet from 'lodash/get';
import _ from 'underscore';
import ONYXKEYS from '../../ONYXKEYS';
import {defaultProps, imagePropTypes} from './imagePropTypes';
import RESIZE_MODES from './resizeModes';
@@ -55,12 +56,12 @@ class Image extends React.Component {
}

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

// eslint-disable-next-line
return <RNImage {...rest} source={imageSource} />;
// eslint-disable-next-line react/jsx-props-no-spreading
return <RNImage {...forwardedProps} source={source} />;
}
}