React-native-svg gradient stop offsets with a fractional value are read as 0 when the system locale uses a decimal comma

:backhand_index_pointing_right: Bug Description


1. Summary

On Vega, SVG gradients render incorrectly when the system language uses a comma as its decimal separator. Fractional <Stop offset> values such as 0.5 appear to be read as 0, so a multi-stop gradient collapses to a single colour. The same app and code render correctly in locales that use a decimal dot.

Bug Severity
Select one that applies

  • Impacts operation of app
  • Blocks current development
  • Improvement suggestion
  • Issue with documentation (If selected, please share the doc link and describe the issue)
  • Other

2. Steps to Reproduce

  1. Render the example SVG below in an app.
  2. Set the system locale to en-US, force-stop and cold-start the app, and note the result.
  3. Set the system locale to de-DE (or es-ES), force-stop and cold-start the app, and compare.
  4. To confirm the decimal separator is the trigger, repeat with es-MX, a Spanish locale that uses a decimal dot.
    I confirmed the active separator with I18nManager.getSystemLocale() and (1.5).toLocaleString(locale).

3. Observed Behavior

Explain what actually happened, noting any discrepancies or malfunctions.

System locale	Decimal separator	Result
en-US	         dot                correct
es-MX	         dot                correct
es-ES	         comma              broken
de-DE	         comma              broken

Sample (a), two stops at offset="0.5": in de-DE it renders as solid blue, as if both offsets were 0 and only the last stop's colour is painted.

Sample (b), stops at 0 and 1: unchanged in every locale.

Sample (c), plain fills: unchanged in every locale.
Real asset: a radial-gradient dome with 33 fractional stops turned into a flat pale-cyan shape in de-DE and es-ES.
Integer lengths: rescaling every cx, cy, r and strokeWidth to integers did not change anything, so lengths are not the problem.

4. Expected Behavior

Describe what you expected the SDK to do under normal operation.

Gradient stop offsets should render identically in every system locale. Sample (a) should show a hard red-to-blue split at 50% in de-DE, as it does in en-US.

4.a Possible Root Cause & Temporary Workaround

Fill out anything you have tried. If you don’t know, N/A is acceptable

the offsets reach the native service as a float array, and the JS side parses them locale-independently, so the problem appears to be in the OS SVG service (com.amazon.kepler.svg_2@ISVG_0). Locale-aware parsing of a fractional value there would explain why only comma-decimal locales fail. I can't see the native source, so this is an inference. Fractional stop opacities and element opacity may be affected too, but I haven't isolated that.

Temporary workaround: replace the gradient SVG with a PNG Image.

6. Environment

Please fill out the fields related to your bug below:

  • SDK Version: 0.23.8358

  • React Native Version: RN0.72

  • App State: Foreground

  • OS Information: Please ssh into the device via vega exec vda shell (or kepler exec vda shell for v0.21 and earlier) and copy the output from cat /etc/os-release into the answer section below. Note, if you don’t have a simulator running or device attached, the command will respond with vda: no devices/emulators found

    NAME="OS"
    OE_VERSION="4.0.0"
    OS_MAJOR_VERSION="2"
    OS_MINOR_VERSION="0"
    RELEASE_ID="26"
    OS_VERSION="2.0"
    BRANCH_CODE="TV Ship"
    BUILD_DESC="OS 2.0 (TV Ship/515)"
    BUILD_FINGERPRINT="4.0.512374.0(3072cab629675a74)/515N:user/release-keys"
    BUILD_VARIANT="user"
    BUILD_TAGS="release-keys"
    BUILD_DATE="Fri Oct 02 22:31:28 UTC 2026"
    BUILD_TIMESTAMP="1790980288"
    VERSION_NUMBER="2602000051520"
    

7. Example Code Snippet / Screenshots / Screengrabs

Include any relevant code or component setup in React Native that can help reproduce the bug.

import { Svg, Defs, RadialGradient, Stop, Circle } from '@amazon-devices/react-native-svg';

export const GradientRepro = () => (
  <Svg width={400} height={120} viewBox="0 0 400 120">
    <Defs>
      <RadialGradient id="hardSplit">
        <Stop offset="0.5" stopColor="#FF0000" />
        <Stop offset="0.5" stopColor="#0000FF" />
      </RadialGradient>
      <RadialGradient id="endsOnly">
        <Stop offset="0" stopColor="#FF0000" />
        <Stop offset="1" stopColor="#0000FF" />
      </RadialGradient>
    </Defs>
    <Circle cx={60} cy={60} r={50} fill="url(#hardSplit)" />
    <Circle cx={200} cy={60} r={50} fill="url(#endsOnly)" />
    <Circle cx={340} cy={60} r={50} fill="#FF0000" />
  </Svg>
);

Hi @Zubair_Naseem,

Thank you for the detailed bug report on the SVG gradient stop offset issue in decimal-comma locales. The locale isolation (en-US/es-MX dot = correct, de-DE/es-ES comma = broken), the (1.5).toLocaleString(locale) confirmation, and ruling out length magnitude all made this very easy to understand.

What looks to be happening

Your locale isolation points strongly to a decimal-separator issue, and that’s a very plausible explanation: in locales that use a decimal comma, a fractional offset like 0.5 appears to be read as 0, which would collapse a multi-stop gradient to effectively the last stop’s color - matching your “solid blue” result. Offsets of 0 and 1 and plain fills having no fractional part is consistent with that theory.

For reference, @amazon-devices/react-native-svg supports RadialGradient, LinearGradient, and Stop on Vega - see the react-native-svg library documentation (react-native-svg - Amazon Vega Docs) and its Components reference (react-native-svg - Amazon Vega Docs). So this appears to be a fractional-offset handling issue under comma-decimal locales rather than an unsupported feature.

Worth trying in the meantime

Percentage offsets may sidestep the problem, since a value like 50% doesn’t depend on a decimal separator:

{/* instead of offset="0.5" */}
<Stop offset="50%" stopColor="#FF0000" />
<Stop offset="50%" stopColor="#0000FF" />

For your 33-stop radial dome, converting each fractional offset to its % equivalent would be the thing to test. If you’re able to try this, could you let us know whether it renders correctly in de-DE/es-ES? Your PNG Image fallback also remains a valid stopgap.

It would also help us to know the exact device/model you’re testing on, in addition to the OS build you already shared (OS 2.0 (TV Ship/515)).

Our team is investigating this issue and will provide an update as soon as we have more information.

Thanks for helping us improve the Vega platform.

Warm regards,
Aishwarya

Hi,

Thanks for getting back.
I tried the suggested solution but it’s still the same issue, percentage did not work as well.
Device: Amazon Fire TV stick 4k Select

Regards,

Zubair