fix(android): skip null gradient color stop positions instead of warning - #58636
tshmieldev wants to merge 1 commit into
Conversation
processBackgroundImage emits `position: null` for every color stop that has no explicit position, which is the common case (`linear-gradient(red, blue)`). LinearGradient and RadialGradient passed that null straight to LengthPercentage.setFromDynamic, which logs "Unsupported type for radius property: Null" for each such stop on every props update. With an animated backgroundImage this floods logcat at 60 Hz. Check for a null position first, the same way BackgroundPosition already does, so a missing position is treated as "auto" without a warning.
|
Hi @tshmieldev! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary:
processBackgroundImageemitsposition: nullfor every color stop that has no explicit position, which is the common case (linear-gradient(red, blue)). On Android,LinearGradientandRadialGradientpass that value straight toLengthPercentage.setFromDynamic, which logsonce per such stop on every props update. A static view logs it on each render; an animated
backgroundImage(e.g. Reanimated CSS animations) floods logcat at frame rate. The value itself is handled correctly (nullposition → evenly spaced), so this is purely log noise, but it drowns out real warnings.BackgroundPositionalready guards againstReadableType.Nullbefore callingsetFromDynamic; this change does the same for gradient color stops in both gradient parsers.Changelog:
[ANDROID] [FIXED] - Stop logging "Unsupported type for radius property: Null" for gradient color stops without an explicit position
Test Plan:
Built React Native from source (
includeBuild('../node_modules/react-native')) in an app that animatesbackgroundImageon Android (Pixel 9 Pro emulator, API 37) and counted the warning inadb logcatover an identical ~90 s run:Unsupported type for radius property: NullGradients with and without stop positions render the same as before.
yarn format-check-kotlin(ktfmt) passes on the changed files.