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

Image component returns different data between iOS and Android in onLoad prop #45188

Open
bohdanprog opened this issue Jun 26, 2024 · 1 comment · May be fixed by #45198
Open

Image component returns different data between iOS and Android in onLoad prop #45188

bohdanprog opened this issue Jun 26, 2024 · 1 comment · May be fixed by #45198

Comments

@bohdanprog
Copy link

bohdanprog commented Jun 26, 2024

Description

Hello, I looked at the output of the onLoad function. Can you help me understand why the size differs for the same image between iOS and Android platforms?
Image link: https://image-placeholder.com/images/actual-size/75x75.png
IOS:

RNImage:ios load PNG image from url with strict size {"source": {"height": 25.333333333333332, "uri": "https://image-placeholder.com/images/actual-size/75x75.png", "width": 25.333333333333332}, "target": 3}

ANDROID:

RNImage:android load PNG image from url with strict size {"source": {"height": 76, "uri": "https://image-placeholder.com/images/actual-size/75x75.png", "width": 76}}

Steps to reproduce

  1. git clone [email protected]:bohdanprog/react-native-image-onLoad-prop.git
  2. cd react-native-image-onLoad-prop
  3. yarn
  4. yarn start
  5. yarn ios

React Native Version

0.75.0-nightly-20240612-fd618819c

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.4.1
  CPU: (11) arm64 Apple M3 Pro
  Memory: 104.17 MB / 18.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.9.0
    path: ~/.nvm/versions/node/v20.9.0/bin/node
  Yarn:
    version: 3.6.4
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.1.0
    path: ~/.nvm/versions/node/v20.9.0/bin/npm
  Watchman:
    version: 2024.04.08.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.3 AI-233.14808.21.2331.11709847
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.75.0-nightly-20240611-5b3a32142
    wanted: 0.75.0-nightly-20240611-5b3a32142
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

IOS:

RNImage:ios load PNG image from url with strict size {"source": {"height": 25.333333333333332, "uri": "https://image-placeholder.com/images/actual-size/75x75.png", "width": 25.333333333333332}, "target": 3}

ANDROID:

RNImage:android load PNG image from url with strict size {"source": {"height": 76, "uri": "https://image-placeholder.com/images/actual-size/75x75.png", "width": 76}}

Reproducer

https://github.com/bohdanprog/react-native-image-onLoad-prop

Screenshots and Videos

No response

@zhongwuzw
Copy link
Contributor

@bohdanprog Thanks for the report, I'll create a PR to fix this inconsistent. But it's a breaking change I think :) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants