Passing a multi-element array to Image causes a crash on Android

This issue has been tracked since 2022-09-16.

Description

Hey RN maintainers,

I've made a repo with this one, which I hope is reproducible. The crash happens at least on Android Emulator, but we've also reproduced it on a Pixel 5. The repo was created with expo, but I'm not sure if that makes much of a difference.

The error message is Error while updating property 'src' of a view managed by: RCTImageView.

I've also posted this question on StackOverflow, as it might be a mistake on my end instead of an actual bug.

Version

0.69.5

Output of npx react-native info

info Fetching system and libraries information...
System:
    OS: macOS 12.6
    CPU: (8) arm64 Apple M1
    Memory: 775.95 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.7.0 - ~/.nvm/versions/node/v18.7.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.7.0/bin/yarn
    npm: 8.18.0 - ~/.nvm/versions/node/v18.7.0/bin/npm
    Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8815526
    Xcode: 14.0/14A309 - /usr/bin/xcodebuild
  Languages:
    Java: 15.0.2 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0 
    react-native: 0.69.5 => 0.69.5 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

I've made a repo, opening it on Android Emulator crashes the app on launch.

Snack, code example, screenshot, or link to a repository

https://github.com/flowchase/break-image-component

danilobuerger wrote this answer on 2022-09-20

Does it work when you add width and height to each source object in the array?

filipecatraia wrote this answer on 2022-09-20

@danilobuerger Yes, that makes the problem go away. With these network images I can't be sure what width/heights I'll be getting, as they are assets uploaded by the team; that would make it impossible to know the width/height beforehand.

danilobuerger wrote this answer on 2022-09-20

The error message could be better, but the docs are clear:

This prop can also contain several remote URLs, specified together with their width and height and potentially with scale/other URI arguments.

https://reactnative.dev/docs/image#source

filipecatraia wrote this answer on 2022-09-20

Damn, I missed that. Do you know why it doesn't break on iOS?

danilobuerger wrote this answer on 2022-09-20

No, but you could investigate it. Maybe there is a way to not require it at all on both platforms.

filipecatraia wrote this answer on 2022-09-20

Interestingly this is recent, since we upgraded to RN 0.69.5. Android didn't crash in our last build.

@danilobuerger Yeah, fair enough. Thanks for your help!

cortinico wrote this answer on 2022-09-20

Can we consider this resolved?

filipecatraia wrote this answer on 2022-09-21

I'd argue the behavior is sub-optimal and a ‘regression’. But by all means, go ahead and close it, as it is technically the expected result.

More Details About Repo
Owner Name facebook
Repo Name react-native
Full Name facebook/react-native
Language JavaScript
Created Date 2015-01-09
Updated Date 2022-10-05
Star Count 105161
Watcher Count 3671
Fork Count 22480
Issue Count 2227

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date