-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Unable to use height and width as props in Image components #41151
Comments
|
I checked this on latest version 0.72.6 as well. This issue still exists. I did some debugging around this. In 0.69.1 In 0.72.6 So if I just pass whole props instead of restProps in native Props it works This is the commit: #34481 where height and width are extracted out. |
Repro link: https://snack.expo.dev/@sg43245/401ed2 |
Any update here? @cortinico |
@cortinico Can you assign this issue to me? |
Summary: Fixes this: #41151 ## Changelog: [GENERAL] [FIXED] - Passed height and width as native props to support cases where source is an array. **Issue**: Unable to use height and width as props in Image components when passing source as an array. This functionality worked before this [commit](#34481). In Image.android.js and Image.ios.js, height and width props are extracted before passing them to the native side. This extraction makes these props ineffective when passed directly. Although setting height and width in style is a workaround, these props should still be respected since they exist for this purpose. The issue occurs only when the source prop is an array. When source is an object, width and height are manually passed to the style object, so the issue doesn't arise. Pull Request resolved: #47044 Test Plan: Tested this on `rn-tester` app Reviewed By: necolas, javache Differential Revision: D64458292 Pulled By: cipolleschi fbshipit-source-id: 5cacad79b8d4468a4a1fd0977221e42ce4b2e5d1
Description
Unable to use height and width as props in Image components. It's working in rn
0.69.1
but not working after upgrade to0.72.4
. Because of this my Images are not visible on screenReact Native Version
0.72.4
Output of
npx react-native info
System:
OS: macOS 13.4.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 839.98 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 16.14.0
path: /usr/local/bin/node
Yarn:
version: 1.22.19
path: /usr/local/bin/yarn
npm:
version: 8.3.1
path: /usr/local/bin/npm
Watchman:
version: 2023.10.02.00
path: /usr/local/bin/watchman
Managers:
CocoaPods:
version: 1.11.3
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 22.2
- iOS 16.2
- macOS 13.1
- tvOS 16.1
- watchOS 9.1
Android SDK:
API Levels:
- "29"
- "30"
- "31"
- "32"
- "33"
- "34"
Build Tools:
- 28.0.3
- 29.0.1
- 29.0.2
- 29.0.3
- 30.0.1
- 30.0.2
- 30.0.3
- 31.0.0
- 31.0.0
- 33.0.0
- 33.0.1
System Images:
- android-24 | Google APIs Intel x86 Atom
- android-24 | Google Play Intel x86 Atom
- android-29 | Google Play Intel x86 Atom
- android-30 | Google APIs Intel x86 Atom
- android-30 | Google Play Intel x86 Atom
- android-31 | Intel x86_64 Atom
- android-31 | Google Play Intel x86 Atom_64
- android-33 | Google Play Intel x86_64 Atom
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9619390
Xcode:
version: 14.2/14C18
path: /usr/bin/xcodebuild
Languages:
Java:
version: 1.8.0_281
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.72.4
wanted: 0.72.4
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Steps to reproduce
Below is the sample Image component where I am passing array of sources to it with height and width passed as props.
Image is seen visible in rn 0.69.1 but not after rn upgrade 0.72.4.
Note: If I pass single source without any array then things are working fine.
Snack, screenshot, or link to a repository
Repro: https://snack.expo.dev/@sg43245/401ed2
Behaviour in 0.69.1 [Working]
Behaviour in 0.72.4 [Not Working]
The text was updated successfully, but these errors were encountered: