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

Fix image cannot show in iOS 14 #29420

Closed
wants to merge 1 commit into from

Conversation

tomcheung
Copy link

Summary

This PR is to fix #29279, which image cannot show in iOS 14
As #29279 (comment) mention, this issue can be fixed by calling [super displayLayer:layer]; it it is still image, to let UIImageView handle still image rendering

Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Test Plan

Image can be shown in iOS 14 build with Xcode 12 beta, using

<Image source={require('./images/some_local_image.jpg')}/>

It may also need to test gif image is render correctly

<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>

@tomcheung tomcheung requested a review from shergin as a code owner July 18, 2020 12:21
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 18, 2020
@react-native-bot react-native-bot added Bug Platform: iOS iOS applications. labels Jul 18, 2020
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 6,764,156 -34
android hermes armeabi-v7a 6,431,774 -31
android hermes x86 7,151,856 -25
android hermes x86_64 7,041,863 -30
android jsc arm64-v8a 8,935,723 -29
android jsc armeabi-v7a 8,595,731 -21
android jsc x86 8,766,538 -35
android jsc x86_64 9,342,180 -25

Base commit: f00795d

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: f00795d

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shergin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@shergin merged this pull request in 123423c.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jul 20, 2020
grabbou pushed a commit that referenced this pull request Jul 22, 2020
Summary:
This PR is to fix #29279, which image cannot show in iOS 14
As #29279 (comment) mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Pull Request resolved: #29420

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
tsapeta pushed a commit to expo/react-native that referenced this pull request Jul 31, 2020
Summary:
This PR is to fix facebook#29279, which image cannot show in iOS 14
As facebook#29279 (comment) mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Pull Request resolved: facebook#29420

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
tsapeta pushed a commit to expo/react-native that referenced this pull request Jul 31, 2020
Summary:
This PR is to fix facebook#29279, which image cannot show in iOS 14
As facebook#29279 (comment) mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Pull Request resolved: facebook#29420

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
tsapeta pushed a commit to expo/react-native that referenced this pull request Jul 31, 2020
Summary:
This PR is to fix facebook#29279, which image cannot show in iOS 14
As facebook#29279 (comment) mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Pull Request resolved: facebook#29420

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
tsapeta pushed a commit to expo/react-native that referenced this pull request Jul 31, 2020
Summary:
This PR is to fix facebook#29279, which image cannot show in iOS 14
As facebook#29279 (comment) mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Pull Request resolved: facebook#29420

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
jmikulka pushed a commit to Skyscanner/react-native that referenced this pull request Aug 28, 2020
Summary:
This PR is to fix facebook#29279, which image cannot show in iOS 14
As facebook#29279 (comment) mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Pull Request resolved: facebook#29420

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
lnikkila pushed a commit to Boulevard/react-native that referenced this pull request Sep 18, 2020
Summary:
This PR is to fix facebook#29279, which image cannot show in iOS 14
As facebook#29279 (comment) mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Pull Request resolved: facebook#29420

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
douglowder pushed a commit to react-native-tvos/react-native-tvos that referenced this pull request Sep 21, 2020
Summary:
This PR is to fix facebook/react-native#29279, which image cannot show in iOS 14
As facebook/react-native#29279 (comment) mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Pull Request resolved: facebook/react-native#29420

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
@mateodaza
Copy link

Was this tested on iOS release mode? It doesn't seem to work for me

@tbanj
Copy link

tbanj commented Oct 13, 2020

If image is not showing on your ios simulator or phone the best bet is to resolve it by upgrading the react-native version within your project
below are the steps to take
`
$ npx react-native upgrade 0.63.2

resolve merge conflicts
delete podlock.file in your ios folder

run below command
gem list --local | grep cocoapods

sudo gem uninstall (each item from above command)

sudo rm -rf ~/.cocoapods

sudo gem install cocoapods

cd (PROJECT DIRECTORY)

pod init

(put cocoapod in podfile)

pod install

rm -rf ~/.cocoapods/repos/trunk/

pod cache clean --all

pod install`

https://stackoverflow.com/a/60849495/7702345

@tbanj
Copy link

tbanj commented Oct 13, 2020

I had the same issues this what I did #29420 (comment)

Copy link

@mesunil2010 mesunil2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixed for me.

jonwu pushed a commit to discord/react-native that referenced this pull request Nov 24, 2020
Summary:
This PR is to fix facebook#29279, which image cannot show in iOS 14
As facebook#29279 (comment) mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Pull Request resolved: facebook#29420

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
jonwu pushed a commit to discord/react-native that referenced this pull request Nov 24, 2020
Summary:
This PR is to fix facebook#29279, which image cannot show in iOS 14
As facebook#29279 (comment) mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Pull Request resolved: facebook#29420

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
tido64 added a commit to microsoft/react-native-test-app that referenced this pull request Dec 15, 2020
This change monkey patches React Native on versions prior to 0.63.2 to
fix a bug with images not rendering when on iOS 14.

See facebook/react-native#29420.
tido64 added a commit to microsoft/react-native-test-app that referenced this pull request Dec 16, 2020
This change monkey patches React Native on versions prior to 0.63.2 to
fix a bug with images not rendering when on iOS 14.

See facebook/react-native#29420.
tido64 added a commit to microsoft/react-native-test-app that referenced this pull request Dec 16, 2020
This change monkey patches React Native on versions prior to 0.63.2 to
fix a bug with images not rendering when on iOS 14.

See facebook/react-native#29420.
tido64 added a commit to microsoft/react-native-test-app that referenced this pull request Dec 17, 2020
This change monkey patches React Native on versions prior to 0.63.2 to
fix a bug with images not rendering when on iOS 14.

See facebook/react-native#29420.
@Saadnajmi
Copy link
Contributor

Is there any plan to cherry pick this commit back into RN 0.62-stable ?

cristeahub pushed a commit to HyreAS/react-native that referenced this pull request Dec 21, 2020
Summary:
This PR is to fix facebook#29279, which image cannot show in iOS 14
As facebook#29279 (comment) mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Pull Request resolved: facebook#29420

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
@udaysagartammina
Copy link

Was this tested on iOS release mode? It doesn't seem to work for me

same issue in release mode, any solution?
Thanks in advance.

@fredcoder
Copy link

If you get this error while taking the step (sudo gem install cocoapods): "You have to install development tools first".

Just run:
xcode-select --install
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

that worked for me.

@smanzini
Copy link

Summary

This PR is to fix #29279, which image cannot show in iOS 14
As #29279 (comment) mention, this issue can be fixed by calling [super displayLayer:layer]; it it is still image, to let UIImageView handle still image rendering

Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Test Plan

Image can be shown in iOS 14 build with Xcode 12 beta, using

<Image source={require('./images/some_local_image.jpg')}/>

It may also need to test gif image is render correctly

<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>

@tomcheung But that's exactly what I've got already on react-native/Libraries/Image/RCTUIImageViewAnimated.m (see below) and still not displaying images for device... :-(


  • (void)displayLayer:(CALayer *)layer
    {
    if (_currentFrame) {
    layer.contentsScale = self.animatedImageScale;
    layer.contents = (__bridge id)_currentFrame.CGImage;
    } else {
    [super displayLayer:layer];
    }
    }

@cinder92
Copy link

cinder92 commented Oct 1, 2021

Summary

This PR is to fix #29279, which image cannot show in iOS 14
As #29279 (comment) mention, this issue can be fixed by calling [super displayLayer:layer]; it it is still image, to let UIImageView handle still image rendering

Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Test Plan

Image can be shown in iOS 14 build with Xcode 12 beta, using

<Image source={require('./images/some_local_image.jpg')}/>

It may also need to test gif image is render correctly

<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>

@tomcheung But that's exactly what I've got already on react-native/Libraries/Image/RCTUIImageViewAnimated.m (see below) and still not displaying images for device... :-(

  • (void)displayLayer:(CALayer *)layer
    {
    if (_currentFrame) {
    layer.contentsScale = self.animatedImageScale;
    layer.contents = (__bridge id)_currentFrame.CGImage;
    } else {
    [super displayLayer:layer];
    }
    }

same issue here on ios 15 and Xcode 12.5

@webdiego
Copy link

webdiego commented Sep 8, 2022

I still have this issue...any solution? It passed two years

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: iOS iOS applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image cannot show image in iOS 14