Skip to content

Fix <Image> resizeMode="cover"#407

Merged
tom-un merged 38 commits intomicrosoft:masterfrom
tom-un:tomun/imagecovermode
May 21, 2020
Merged

Fix <Image> resizeMode="cover"#407
tom-un merged 38 commits intomicrosoft:masterfrom
tom-un:tomun/imagecovermode

Conversation

@tom-un
Copy link
Copy Markdown
Collaborator

@tom-un tom-un commented May 21, 2020

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

The <Image> prop resizeMode="cover" was not working. The reason was due to an incorrect manual merge from upstream. In the past RCTImageView was a subclass of UIImageView. When the macOS port was created it sublcassed NSImageView. About 13 months ago upstream RCTImageView was changed to subclass RCTView. When we merged that subtlety wasn't caught and we continued to sublcass NSImageView. So when the imageScaling property was being mapped from the JS, it was setting it on the RCTImageView/NSImageView instead of the subview which is the real NSImageView that loads the image.

Also, the RNTesterExampleContainer has a platform property that upstream is a string, but in the fork can be a string or an Array. During a past merge we lost the changed in RNTesterExampleContainer that understood that platform could be an Array so we were not showing test containers that were ['ios', 'macos'].

Several of the ImageExample tests couldn't load an image because the facebook image urls are no longer valid. This change cherry picks some changes from react-native master to use the most up-to-date image urls.

The 'Bundled images' test container was duplicated for macOS. This change de-dupes it.

Resolves issue #316

Changelog

[macOS] [Fixed] - Fix resizeMode="cover"

Test Plan

Tested in RNTester.

Microsoft Reviewers: Open in CodeFlow

tom-un and others added 30 commits April 3, 2020 20:53
@tom-un tom-un requested a review from HeyImChris May 21, 2020 00:40
@tom-un tom-un linked an issue May 21, 2020 that may be closed by this pull request
@tom-un tom-un mentioned this pull request May 21, 2020
4 tasks
@tom-un tom-un merged commit 375336b into microsoft:master May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Image] resizeMode="cover" does not work correctly on macOS

3 participants