You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android: why is Image#fadeDuration not an opt-in feature so it's consistent with iOS? #10194
When porting an app to Android, you notice images starts to weirdly fade in when they appear, it might not work properly if you manage yourself the "degraded loading" of images and stuff like that.
I'm wondering why this fadeDuration has been conceived to be opt-out to disable. React Native have an hardcoded default value of 300ms that you can't even override.. (what if I want to disable it completely, I can't).
Why is fadeDuration not opt-in, so you explicitely enable it? It would be consistent with Image.ios and eventually we could image iOS to support this prop too.
Thanks for bringing this up! I suspect this is to make things feel more native, to act like the underlying platform does. At this point making it opt-in would be a breaking change and I don't think that is worth it.
Would be nice to have this feature opt-out. I managed to prevent the fade animation by wrapping my <Image /> with a custom ViewGroupManager and setting ReactImageView.mFadeDuration to zero with reflection before the Image is added to the custom ViewGroup.
@DylanVann yeah, it's possible to override fadeDuration, but in this issue I was just asking why the default is 300ms where I think it should be 0ms if we ever want iOS and Android to be consistent.
the workaround is to define your own Image and override the defaults but I wish there would be a better way to set that default globally at least.
It's generally better to match platform standards rather than try to be pixel identical, so this is how we try to make the defaults. But of course you should also pay close attention to the design on both platforms and dial them in the way you want. For high quality multi-platform apps, only about 85-90% of code is shared, and the remaining 10-15% is needed to make the app conform to platform specifics.
Activity
lacker commentedon Dec 17, 2016
Thanks for bringing this up! I suspect this is to make things feel more native, to act like the underlying platform does. At this point making it opt-in would be a breaking change and I don't think that is worth it.
guyca commentedon Dec 17, 2016
Would be nice to have this feature opt-out. I managed to prevent the fade animation by wrapping my
<Image />with a customViewGroupManagerand settingReactImageView.mFadeDurationto zero with reflection before the Image is added to the customViewGroup.Something like this:
ReflectionUtils.setFieldimplementation:DylanVann commentedon Jan 29, 2017
fadeDurationis a prop onImagefor android now. This is not documented.gre commentedon Jan 29, 2017
@DylanVann yeah, it's possible to override fadeDuration, but in this issue I was just asking why the default is 300ms where I think it should be 0ms if we ever want iOS and Android to be consistent.
the workaround is to define your own
Imageand override the defaults but I wish there would be a better way to set that default globally at least.DylanVann commentedon Jan 29, 2017
@gre yeah I agree it should probably be consistent. Just mentioning that I don't think @guyca 's solution is necessary.
Just use:
guyca commentedon Jan 29, 2017
@DylanVann Thanks a lot! Obviously that was a hack since I wasn't aware of fadeDuration
sahrens commentedon Dec 5, 2017
It's generally better to match platform standards rather than try to be pixel identical, so this is how we try to make the defaults. But of course you should also pay close attention to the design on both platforms and dial them in the way you want. For high quality multi-platform apps, only about 85-90% of code is shared, and the remaining 10-15% is needed to make the app conform to platform specifics.