-
Notifications
You must be signed in to change notification settings - Fork 49.3k
Closed
Labels
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When you use react-art
rendrer, the Consumer
is picking up the default value defined by the initial creation of the context rather than the values provided by Provider.
Actual behabiour: Shape
has y = 10
(initial value).
import React from "react";
import { render } from "react-dom";
var ReactART = require("react-art");
var Group = ReactART.Group;
var Shape = ReactART.Shape;
var Surface = ReactART.Surface;
var RED_DOT_PATH =
"M12.5,17 C16.0898511,17 19,14.0898511 19,10.5 C19,6.91014895 16.0898511,4 12.5,4 C8.91014895,4 6,6.91014895 6,10.5 C6,14.0898511 8.91014895,17 12.5,17 Z M12.5,17";
const { Consumer, Provider } = React.createContext({ x: 0, y: 10 });
const App = () => (
<Provider value={{ x: 0, y: 100 }}>
<Surface width={700} height={700}>
<Consumer>
{({ x, y }) => {
return <Shape x={x} y={y} fill="#D97B76" d={RED_DOT_PATH} />;
}}
</Consumer>
</Surface>
</Provider>
);
render(<App />, document.getElementById("root"));
Demo: https://codesandbox.io/s/llx6kv6527
What is the expected behavior?
Shape
should have y = 100
(provided value).
v16.3.2 for react
, react-dom
and react-art
theoutlander