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

Unable to pass height, width props to Image component #36182

Closed
rawatnaresh opened this issue Feb 16, 2023 · 8 comments
Closed

Unable to pass height, width props to Image component #36182

rawatnaresh opened this issue Feb 16, 2023 · 8 comments
Labels
Component: Image Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@rawatnaresh
Copy link

Description

Passing props such as height, width, crossOrigin to the Image component throws an error.

Screen Shot 2023-02-16 at 16 50 06

Version

0.71.0

Output of npx react-native info

System:
OS: macOS 12.6.2
CPU: (4) x64 Intel(R) Core(TM) i7-5650U CPU @ 2.20GHz
Memory: 72.01 MB / 8.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.16.0 - ~/.nodenv/versions/16.16.0/bin/node
Yarn: 1.22.19 - ~/.nodenv/versions/16.16.0/bin/yarn
npm: 8.11.0 - ~/.nodenv/versions/16.16.0/bin/npm
Watchman: 2022.07.04.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /Users/nareshrawat/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK:
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /Users/nareshrawat/.jenv/shims/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.3 => 0.71.3
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

  • Init a new RN project
  • Add a Image component
  • All the props that are mentioned in the docs are not supported

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

RN > 0.71.0

Screen Shot 2023-02-16 at 16 58 56

RN < 0.71.0

Screen Shot 2023-02-16 at 16 59 59

@redpanda-bit
Copy link

I was able to reproduce. I vote for the typescript interface of Image props needing an update to match the docs.

It also works like this source={{uri: 'some-uri', height: 200, width: 200}}.

@alvessteve
Copy link
Contributor

Indeed, those props are missing in the .d file. Just did a PR for that

@redpanda-bit
Copy link

Nice, thanks @alvessteve. height and width alone for this PR would have made it cleaner. Did you confirm that crossOrigin is still in use?

facebook-github-bot referenced this issue Feb 18, 2023
…n file (#36196)

Summary:
According this Issue [`https://github.com/facebook/react-native/issues/36182`](https://github.com/facebook/react-native/issues/36182), the typescript compiler doesn't know the `width`, `height` and `crossOrigin` props for the `Image` component although they are taken in account in the code, [docs](https://reactnative.dev/docs/image#crossorigin) and the flow types.

## Changelog

[GENERAL] [FIXED] - Fix missing `height`, `width`, `crossOrigin` props on Typescript Image.d.ts file

Pull Request resolved: #36196

Reviewed By: christophpurrer

Differential Revision: D43406094

Pulled By: rshest

fbshipit-source-id: 547ed142d7c39c361d195275b79b0885ef829ba1
@alvessteve
Copy link
Contributor

yep still in use.

@rawatnaresh
Copy link
Author

types for following props are also missing 🙏

@alvessteve
Copy link
Contributor

thank you @rawatnaresh ! will do a separate PR for that

OlimpiaZurek referenced this issue in OlimpiaZurek/react-native May 22, 2023
…n file (facebook#36196)

Summary:
According this Issue [`https://github.com/facebook/react-native/issues/36182`](https://github.com/facebook/react-native/issues/36182), the typescript compiler doesn't know the `width`, `height` and `crossOrigin` props for the `Image` component although they are taken in account in the code, [docs](https://reactnative.dev/docs/image#crossorigin) and the flow types.

## Changelog

[GENERAL] [FIXED] - Fix missing `height`, `width`, `crossOrigin` props on Typescript Image.d.ts file

Pull Request resolved: facebook#36196

Reviewed By: christophpurrer

Differential Revision: D43406094

Pulled By: rshest

fbshipit-source-id: 547ed142d7c39c361d195275b79b0885ef829ba1
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 20, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Image Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

4 participants