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├── Project2| |3| ├── android4| ├── ios5| ├── node_modules6| ├── patches // created folder7| ├── src8| ├── App.js9| ├── 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├── Project2| |3| ├── android4| ├── ios5| ├── node_modules6| ├── patches7| | ├── react-native+0.61.1.patch // created patch file8| ├── src9| ├── App.js10| ├── 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.m2index 21f1a06..2444713 1006443--- a/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m4+++ b/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m5@@ -272,6 +272,9 @@ - (void)displayDidRefresh:(CADisplayLink *)displayLink67 - (void)displayLayer:(CALayer *)layer8 {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.env16new file mode 10064417index 0000000..361f5fb18--- /dev/null19+++ b/node_modules/react-native/scripts/.packager.env20@@ -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.
Thanks for reading…
More From React Native Tutorial
Basics
- Introduction To React Native
- React Native Environment Setup using expo
- React Native Environment Setup for windows
- React Native Environment setup on Mac OS
- React Native Environment setup on linux
- React Native Project Structure
- React Native State
- React Native Props
- React Native Styling
- React Native Flexbox
- React Native Text
- React Native Textinput
- React Native Commands
- React Native ScrollView
Advances
- React Native Dark Mode
- React Native Fonts
- React Native SQLite
- React Native DatepickerAndroid
- React native ScrollView scroll to position
- How to align icon with text in react native
- React Native Image
- React Native Firebase Crashlytics
- React Native Async Storage
- React Native Share
Error & Issue Solution
- Task :app:transformDexArchiveWithDexMergerForDebug FAILED In React Native
- Expiring Daemon because JVM heap space is exhausted In React Native
- Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED In React Native
- Unable to determine the current character, it is not a string, number, array, or object in react native
- App crashed immediately after install react native video or track player
- how to delete SQLite database in android react native
- React native material dropdown twice click issue
- How to get the current route in react-navigation?
- how to disable drawer on the drawer navigation screen?
- Image not showing in ios 14 react native
- React Native image picker launchimagelibrary on second time issue
- how to open any link from react native render Html
- Network request failed in react native fetch
- React Native upload video example
Follow me on Twitter
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.