Skip to content

fix(android): fix fadeDuration=0 not working w/ props 2.0 diffing#55521

Closed
hannojg wants to merge 1 commit into
react:mainfrom
hannojg:fix/android-props20-fadeduration-image
Closed

fix(android): fix fadeDuration=0 not working w/ props 2.0 diffing#55521
hannojg wants to merge 1 commit into
react:mainfrom
hannojg:fix/android-props20-fadeduration-image

Conversation

@hannojg

@hannojg hannojg commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Summary:

In our app we are using the props 2.0 diffing mechanism (ie getDiffProps in cpp).
I noticed that our <Image source={...} fadeDuration={0} /> were still showing with the default 300ms fade duration.

The issue is that we instantiate the fadeDuration in cpp with a default value of 0:

https://github.com/facebook/react-native/blob/4356259c79076fc816e516ca98678088a251bb8e/packages/react-native/ReactCommon/react/renderer/components/image/ImageProps.h#L40

and then in the props diff implementation when comparing our prop value of 0 against the default, it will not be added to the final props, thus never set in the native image view:

https://github.com/facebook/react-native/blob/4356259c79076fc816e516ca98678088a251bb8e/packages/react-native/ReactCommon/react/renderer/components/image/ImageProps.cpp#L273-L275

The native image view uses a default value of -1 so i thought to use the same here:

https://github.com/facebook/react-native/blob/4356259c79076fc816e516ca98678088a251bb8e/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.kt#L104

Another solution could be to type the fadeDuration as std::optional, let me know what you prefer

Changelog:

[ANDROID] [FIXED] - Image fadeDuration=0 not working with props 2.0 enabled

Test Plan:

You can enable the props 2.0 feature flags in the RNTesterApp and check the image example!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 11, 2026
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Feb 11, 2026
@meta-codesync

meta-codesync Bot commented Feb 11, 2026

Copy link
Copy Markdown

@fabriziocucci has imported this pull request. If you are a Meta employee, you can view this in D92964613.

@meta-codesync meta-codesync Bot closed this in 3fb5c0b Feb 11, 2026
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Feb 11, 2026
@meta-codesync

meta-codesync Bot commented Feb 11, 2026

Copy link
Copy Markdown

@fabriziocucci merged this pull request in 3fb5c0b.

@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @hannojg in 3fb5c0b

When will my fix make it into a release? | How to file a pick request?

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants