question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] react-native ART and RadialGradient

See original GitHub issue

Environment

OS: Windows 10 Node: 8.9.4 Yarn: 1.5.1 npm: 4.6.1 Watchman: Not Found Xcode: N/A Android Studio: Version 3.0.0.0 AI-171.4443003

Packages: (wanted => installed) react: 16.2.0 => 16.2.0 react-native: 0.52.0 => 0.52.0

Steps to Reproduce

Use react-native ART to draw a shape and fill it with RadialGradient.

import React from "react";
import { View, ART, StyleSheet } from "react-native";

const { Surface, Shape, Group, Path, RadialGradient, LinearGradient } = ART;

const fullRectangle = (width, height) => {
  const d = new Path();
  d.moveTo(0, 0);
  d.lineTo(width, 0);
  d.lineTo(width, height);
  d.lineTo(0, height);
  d.lineTo(0, 0);
  return d;
};

export default (props) => (
    <Surface style={styles.surface} width={props.width} height={props.height}>
      <Group>
        <Shape
          d={fullRectangle(props.width, props.height)}
          fill={
            new RadialGradient(
              {
                ".1": "blue", // blue in 1% position
                "1": "rgba(255, 255, 255, 0)" // opacity white in 100% position
              },
              "200",
              "200",
              "0",
              "0",
              "0",
              "400"
            )
          }
        />
      </Group>
    </Surface>
);

Expected Behavior

Shape should be filled with a radial gradient.

Actual Behavior

Shape filled in black. Whatever parameters/colors I use.

note: fill with a solid color or linear gradient is working.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
anthony-skrcommented, Mar 23, 2018

same with 0.54

1reaction
react-native-botcommented, Mar 19, 2018

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.54?

Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native: Radial Gradient Background
Is there an package, or another way to have a simple, let's say blue to blueish, radial gradient background ...
Read more >
Issue in installing react-native-radial gradient in android
I am trying to implement react-native-radial-gradient but it is working in iOS and not implementing in android. the error is.
Read more >
react-native-svg - npm
The element is used to define a radial gradient. The element must be nested within a <Defs> tag. The <Defs> tag is short...
Read more >
Gradient
react-native -svg. SVG library for react-native. react-componentreact-nativeiosandroidwindowsSVGARTVMLgradient ; expo-linear-gradient. Provides a React component ...
Read more >
react-native-art-svg - npm Package Health Analysis
Learn more about react-native-art-svg: package health score, popularity, ... is built to provide a SVG interface to react native on both iOS and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found