Navigate back to the homepage

Image not showing in ios 14 react native

Infinitbility
React Native
January 22nd, 2021 · 1 min read
Image not showing in ios 14 react native

Hello Friends,

Welcome To Infinitbility!

You react native image component not rendering images in iOS 14 then you have to change react-native node_modules or use patch packages.

Here, I don’t recommend changing your node_modules because you may forget to change when setup another machine or in deployment.

  • patch packages solution get from GitHub after hours of scrolling & researching.

In this article, I am sharing solutions to solve the image rendering issue using patch packages.

the article purpose to save hours of the developer’s


Follow Steps to use patch package of any react native version x.xx.xx

Step 1

Install patch package globally on your machine.

1npm install -g patch-package

Step 2

make patches folder on your react native project root

1├── Project
2| |
3| ├── android
4| ├── ios
5| ├── node_modules
6| ├── patches // created folder
7| ├── src
8| ├── App.js
9| ├── index.js

Step 3

create react-native+X.XX.X.patch file under patches folder.

replace X.XX.X with your react native version for me 0.61.1

1├── Project
2| |
3| ├── android
4| ├── ios
5| ├── node_modules
6| ├── patches
7| | ├── react-native+0.61.1.patch // created patch file
8| ├── src
9| ├── App.js
10| ├── index.js

Step 4

add below code on your react-native+0.61.1.patch file.

react-native+0.61.1.patch

1diff --git a/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m b/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m
2index 21f1a06..2444713 100644
3--- a/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m
4+++ b/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m
5@@ -272,6 +272,9 @@ - (void)displayDidRefresh:(CADisplayLink *)displayLink
6
7 - (void)displayLayer:(CALayer *)layer
8 {
9+ if (!_currentFrame) {
10+ _currentFrame = self.image;
11+ }
12 if (_currentFrame) {
13 layer.contentsScale = self.animatedImageScale;
14 layer.contents = (__bridge id)_currentFrame.CGImage;
15diff --git a/node_modules/react-native/scripts/.packager.env b/node_modules/react-native/scripts/.packager.env
16new file mode 100644
17index 0000000..361f5fb
18--- /dev/null
19+++ b/node_modules/react-native/scripts/.packager.env
20@@ -0,0 +1 @@
21+export RCT_METRO_PORT=8081

Step 5

run patch-package on the root of the project using the terminal.

1patch-package

After completed clean & relaunch your project.

if you get help, please share a post on your social network

More From React Native Tutorial

Basics

  1. Introduction To React Native
  2. React Native Environment Setup using expo
  3. React Native Environment Setup for windows
  4. React Native Environment setup on Mac OS
  5. React Native Environment setup on linux
  6. React Native Project Structure
  7. React Native State
  8. React Native Props
  9. React Native Styling
  10. React Native Flexbox
  11. React Native Text
  12. React Native Textinput
  13. React Native Commands
  14. React Native ScrollView

Advances

  1. React Native Dark Mode
  2. React Native Fonts
  3. React Native SQLite
  4. React Native DatepickerAndroid
  5. React native ScrollView scroll to position
  6. How to align icon with text in react native
  7. React Native Image
  8. React Native Firebase Crashlytics
  9. React Native Async Storage
  10. React Native Share

Error & Issue Solution

  1. Task :app:transformDexArchiveWithDexMergerForDebug FAILED In React Native
  2. Expiring Daemon because JVM heap space is exhausted In React Native
  3. Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED In React Native
  4. Unable to determine the current character, it is not a string, number, array, or object in react native
  5. App crashed immediately after install react native video or track player
  6. how to delete SQLite database in android react native
  7. React native material dropdown twice click issue
  8. How to get the current route in react-navigation?
  9. how to disable drawer on the drawer navigation screen?
  10. Image not showing in ios 14 react native
  11. React Native image picker launchimagelibrary on second time issue
  12. how to open any link from react native render Html

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

More articles from Infinitbility

Laravel Model

Laravel Model

Laravel model required things to done to your project to use laravel models.

January 20th, 2021 · 1 min read
CSS Combinators

CSS Combinators

A combinator is something that explains the relationship between the selectors.

January 15th, 2021 · 1 min read
© 2020–2021 Infinitbility
Disclaimer
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]