victory-native
Advanced tools
Comparing version 0.16.6 to 0.17.0
# VictoryNative Changelog | ||
## 0.17.0 (2018-02-06) | ||
-[250](https://github.com/FormidableLabs/victory-native/pull/250) Refactors all primitive components and updates to `victory@0.25.2` dependencies. See [CHANGELOG](https://github.com/FormidableLabs/victory/blob/master/CHANGELOG.md#0250-2018-02-04). | ||
*Note: `VictoryBrushLine` is not implemented in `victory-native`* | ||
## 0.16.6 (2018-01-03) | ||
@@ -4,0 +9,0 @@ |
@@ -11,4 +11,3 @@ import React from "react"; | ||
export default class extends VictoryArea { | ||
static defaultProps = { | ||
...VictoryArea.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryArea.defaultProps, { | ||
dataComponent: <Area/>, | ||
@@ -19,3 +18,3 @@ labelComponent: <VictoryLabel/>, | ||
width: Dimensions.get("window").width | ||
} | ||
}); | ||
} |
@@ -8,16 +8,15 @@ import React from "react"; | ||
import VictoryContainer from "./victory-container"; | ||
import { Line } from "../index"; | ||
import { Axis } from "../index"; | ||
export default class extends VictoryAxis { | ||
static defaultProps = { | ||
...VictoryAxis.defaultProps, | ||
axisComponent: <Line/>, | ||
static defaultProps = Object.assign({}, VictoryAxis.defaultProps, { | ||
axisComponent: <Axis/>, | ||
axisLabelComponent: <VictoryLabel/>, | ||
tickLabelComponent: <VictoryLabel/>, | ||
tickComponent: <Line/>, | ||
gridComponent: <Line/>, | ||
tickComponent: <Axis/>, | ||
gridComponent: <Axis/>, | ||
containerComponent: <VictoryContainer/>, | ||
groupComponent: <G/>, | ||
width: Dimensions.get("window").width | ||
}; | ||
}); | ||
} |
@@ -12,4 +12,3 @@ import React from "react"; | ||
export default class extends VictoryBar { | ||
static defaultProps = { | ||
...VictoryBar.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryBar.defaultProps, { | ||
dataComponent: <Bar/>, | ||
@@ -20,3 +19,3 @@ labelComponent: <VictoryLabel/>, | ||
width: Dimensions.get("window").width | ||
} | ||
}); | ||
} |
@@ -17,4 +17,3 @@ import React from "react"; | ||
export const brushContainerMixin = (base) => class VictoryNativeSelectionContainer extends base { // eslint-disable-line max-len | ||
static defaultProps = { | ||
...VictoryContainer.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryContainer.defaultProps, { | ||
selectionStyle: { | ||
@@ -32,3 +31,3 @@ stroke: "transparent", | ||
handleComponent: <RectWithStyle/> | ||
}; | ||
}); | ||
@@ -43,10 +42,4 @@ static defaultEvents = [{ | ||
onTouchMove: (evt, targetProps) => { | ||
const mutations = BrushHelpers.onMouseMove(evt, targetProps); | ||
return BrushHelpers.onMouseMove(evt, targetProps); | ||
if (mutations.id !== this.touchMoveMutationId) { // eslint-disable-line | ||
this.touchMoveMutationId = mutations.id; // eslint-disable-line | ||
return mutations.mutations; | ||
} | ||
return []; | ||
}, | ||
@@ -53,0 +46,0 @@ onTouchEnd: (evt, targetProps) => { |
@@ -12,4 +12,3 @@ import React from "react"; | ||
export default class extends VictoryCandlestick { | ||
static defaultProps = { | ||
...VictoryCandlestick.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryCandlestick.defaultProps, { | ||
dataComponent: <Candle/>, | ||
@@ -20,3 +19,3 @@ labelComponent: <VictoryLabel/>, | ||
width: Dimensions.get("window").width | ||
} | ||
}); | ||
} |
@@ -11,4 +11,3 @@ import React from "react"; | ||
export default class extends VictoryChart { | ||
static defaultProps = { | ||
...VictoryChart.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryChart.defaultProps, { | ||
containerComponent: <VictoryContainer/>, | ||
@@ -25,3 +24,3 @@ groupComponent: <G/>, | ||
width: Dimensions.get("window").width | ||
}; | ||
}); | ||
} |
import React from "react"; | ||
import { G } from "react-native-svg"; | ||
import { NativeHelpers, ClipPath } from "../index"; | ||
import { ClipPath, Circle, Rect } from "../index"; | ||
import { VictoryClipContainer } from "victory-core/es"; | ||
export default class extends VictoryClipContainer { | ||
// Overrides method in victory-core | ||
renderClippedGroup(props, clipId) { | ||
const { style, events, children, className, transform } = props; | ||
const nativeStyle = NativeHelpers.getStyle(style); | ||
const clipComponent = this.renderClipComponent(props, clipId); | ||
return ( | ||
<G {...nativeStyle} {...events} transform={transform} className={className}> | ||
{clipComponent} | ||
<G clipPath={`url(#${clipId})`}> | ||
{children} | ||
</G> | ||
</G> | ||
); | ||
} | ||
// Overrides method in victory-core | ||
renderClipComponent(props, clipId) { | ||
return ( | ||
<ClipPath | ||
{...props} | ||
clipId={clipId} | ||
/> | ||
); | ||
} | ||
// Overrides method in victory-core | ||
renderGroup(props) { | ||
const { style, events, children, className, transform } = props; | ||
const nativeStyle = NativeHelpers.getStyle(style); | ||
return ( | ||
<G {...nativeStyle} {...events} transform={transform} className={className}> | ||
{children} | ||
</G> | ||
); | ||
} | ||
static defaultProps = Object.assign({}, VictoryClipContainer.defaultProps, { | ||
groupComponent: <G/>, | ||
rectComponent: <Rect/>, | ||
clipPathComponent: <ClipPath/>, | ||
circleComponent: <Circle/> | ||
}); | ||
} |
@@ -6,4 +6,3 @@ import React from "react"; | ||
export const cursorContainerMixin = (base) => class VictoryNativeCursorContainer extends base { // eslint-disable-line max-len | ||
static defaultProps = { | ||
...VictoryContainer.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryContainer.defaultProps, { | ||
cursorLabelComponent: <VictoryLabel/>, | ||
@@ -15,3 +14,3 @@ cursorLabelOffset: { | ||
cursorComponent: <Line/> | ||
}; | ||
}); | ||
@@ -22,10 +21,3 @@ static defaultEvents = [{ | ||
onTouchMove: (evt, targetProps) => { | ||
const mutations = CursorHelpers.onMouseMove(evt, targetProps); | ||
if (mutations.id !== this.touchMoveMutationId) { // eslint-disable-line | ||
this.touchMoveMutationId = mutations.id; // eslint-disable-line | ||
return mutations.mutations; | ||
} | ||
return []; | ||
return CursorHelpers.onMouseMove(evt, targetProps); | ||
}, | ||
@@ -32,0 +24,0 @@ onTouchEnd: () => { |
@@ -10,4 +10,3 @@ import React from "react"; | ||
export default class extends VictoryErrorBar { | ||
static defaultProps = { | ||
...VictoryErrorBar.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryErrorBar.defaultProps, { | ||
dataComponent: <ErrorBar/>, | ||
@@ -17,3 +16,3 @@ containerComponent: <VictoryContainer/>, | ||
width: Dimensions.get("window").width | ||
}; | ||
}); | ||
} |
@@ -9,8 +9,7 @@ import React from "react"; | ||
export default class extends VictoryGroup { | ||
static defaultProps = { | ||
...VictoryGroup.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryGroup.defaultProps, { | ||
containerComponent: <VictoryContainer/>, | ||
groupComponent: <G/>, | ||
width: Dimensions.get("window").width | ||
}; | ||
}); | ||
} |
import React from "react"; | ||
import { Text, TSpan } from "react-native-svg"; | ||
import { VictoryLabel } from "victory-core/es"; | ||
import { Text, TSpan } from "../index"; | ||
import { NativeHelpers } from "../index"; | ||
export default class extends VictoryLabel { | ||
static defaultProps = { | ||
...VictoryLabel.defaultProps, | ||
capHeight: 0.71, | ||
lineHeight: 1 | ||
}; | ||
// Overrides method in victory-core | ||
renderElements(props) { | ||
const { className, events } = props; | ||
const textProps = { | ||
dx: this.dx, dy: this.dy, x: this.x, y: this.y, className, transform: this.transform | ||
}; | ||
return ( | ||
<Text {...textProps} {...events}> | ||
{this.content.map((line, i) => { | ||
const style = NativeHelpers.getStyle(this.style[i] || this.style[0]); | ||
const lastStyle = NativeHelpers.getStyle(this.style[i - 1] || this.style[0]); | ||
const fontSize = (style.fontSize + lastStyle.fontSize) / 2; | ||
const textAnchor = style.textAnchor || this.textAnchor; | ||
const dy = i ? (this.lineHeight * fontSize) : undefined; | ||
return ( | ||
<TSpan key={i} x={this.x} dy={dy} dx={this.dx} {...style} textAnchor={textAnchor}> | ||
{line} | ||
</TSpan> | ||
); | ||
})} | ||
</Text> | ||
); | ||
} | ||
static defaultProps = Object.assign({}, VictoryLabel.defaultProps, { | ||
textComponent: <Text/>, | ||
tspanComponent: <TSpan/> | ||
}); | ||
} |
@@ -10,4 +10,3 @@ import React from "react"; | ||
export default class extends VictoryLegend { | ||
static defaultProps = { | ||
...VictoryLegend.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryLegend.defaultProps, { | ||
borderComponent: <Border/>, | ||
@@ -20,3 +19,3 @@ containerComponent: <VictoryContainer/>, | ||
width: Dimensions.get("window").width | ||
}; | ||
}); | ||
} |
@@ -11,4 +11,3 @@ import React from "react"; | ||
export default class extends VictoryLine { | ||
static defaultProps = { | ||
...VictoryLine.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryLine.defaultProps, { | ||
dataComponent: <Curve/>, | ||
@@ -19,3 +18,3 @@ labelComponent: <VictoryLabel/>, | ||
width: Dimensions.get("window").width | ||
}; | ||
}); | ||
} |
@@ -10,4 +10,3 @@ import React from "react"; | ||
export default class extends VictoryPie { | ||
static defaultProps = { | ||
...VictoryPie.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryPie.defaultProps, { | ||
dataComponent: <Slice/>, | ||
@@ -17,3 +16,3 @@ labelComponent: <VictoryLabel/>, | ||
groupComponent: <G/> | ||
}; | ||
}); | ||
} |
@@ -7,8 +7,7 @@ import React from "react"; | ||
import VictoryContainer from "./victory-container"; | ||
import { Line, Arc } from "../index"; | ||
import { Axis, Arc } from "../index"; | ||
export default class extends VictoryPolarAxis { | ||
static defaultProps = { | ||
...VictoryPolarAxis.defaultProps, | ||
axisComponent: <Line/>, | ||
static defaultProps = Object.assign({}, VictoryPolarAxis.defaultProps, { | ||
axisComponent: <Axis/>, | ||
axisLabelComponent: <VictoryLabel/>, | ||
@@ -18,8 +17,8 @@ circularAxisComponent: <Arc type={"axis"}/>, | ||
tickLabelComponent: <VictoryLabel/>, | ||
tickComponent: <Line/>, | ||
gridComponent: <Line/>, | ||
tickComponent: <Axis/>, | ||
gridComponent: <Axis/>, | ||
containerComponent: <VictoryContainer/>, | ||
groupComponent: <G/>, | ||
width: Dimensions.get("window").width | ||
}; | ||
}); | ||
} |
import React from "react"; | ||
import { Path } from "react-native-svg"; | ||
import { NativeHelpers } from "../../index"; | ||
import { Path } from "../../index"; | ||
import { Arc } from "victory-core/es"; | ||
export default class extends Arc { | ||
// Overridden in victory-core-native | ||
renderAxisLine(props, style, events) { | ||
const { role, shapeRendering, className } = props; | ||
const nativeStyle = NativeHelpers.getStyle(style); | ||
const path = this.getArcPath(props); | ||
return ( | ||
<Path className={className} | ||
d={path} | ||
style={style} | ||
role={role || "presentation"} | ||
shapeRendering={shapeRendering || "auto"} | ||
{...nativeStyle} | ||
{...events} | ||
/> | ||
); | ||
} | ||
static defaultProps = Object.assign({}, Arc.defaultProps, { | ||
pathComponent: <Path/> | ||
}); | ||
} |
import React from "react"; | ||
import { Path, G } from "react-native-svg"; | ||
import { NativeHelpers } from "../../index"; | ||
import { Path } from "../../index"; | ||
import { G } from "react-native-svg"; | ||
import { Area } from "victory-core/es"; | ||
export default class extends Area { | ||
static defaultProps = { | ||
groupComponent: <G/> | ||
}; | ||
// Overrides method in victory-core | ||
renderArea(path, style, events) { | ||
const areaStroke = style.stroke ? "none" : style.fill; | ||
const areaStyle = NativeHelpers.getStyle(Object.assign({}, style, { stroke: areaStroke })); | ||
const { role, shapeRendering, className, polar, origin } = this.props; | ||
const transform = polar && origin ? `translate(${origin.x} ${origin.y})` : undefined; | ||
return ( | ||
<Path | ||
key={"area"} | ||
shapeRendering={shapeRendering || "auto"} | ||
role={role || "presentation"} | ||
d={path} | ||
className={className} | ||
transform={transform} | ||
{...areaStyle} | ||
{...events} | ||
/> | ||
); | ||
} | ||
// Overrides method in victory-core | ||
renderLine(path, style, events) { | ||
if (!style.stroke || style.stroke === "none" || style.stroke === "transparent") { | ||
return null; | ||
} | ||
const { role, shapeRendering, className, polar, origin } = this.props; | ||
const lineStyle = NativeHelpers.getStyle(Object.assign({}, style, { fill: "none" })); | ||
const transform = polar && origin ? `translate(${origin.x} ${origin.y})` : undefined; | ||
return ( | ||
<Path | ||
key={"area-stroke"} | ||
shapeRendering={shapeRendering || "auto"} | ||
role={role || "presentation"} | ||
d={path} | ||
className={className} | ||
transform={transform} | ||
{...lineStyle} | ||
{...events} | ||
/> | ||
); | ||
} | ||
static defaultProps = Object.assign({}, Area.defaultProps, { | ||
groupComponent: <G/>, | ||
pathComponent: <Path/> | ||
}); | ||
} |
import React from "react"; | ||
import { Path } from "react-native-svg"; | ||
import { NativeHelpers } from "../../index"; | ||
import { Path } from "../../index"; | ||
import { Bar } from "victory-core/es"; | ||
export default class extends Bar { | ||
// Overrides method in victory-core | ||
renderBar(path, style, events) { | ||
const nativeStyle = NativeHelpers.getStyle(style); | ||
const { role, shapeRendering, className, polar, origin } = this.props; | ||
const transform = polar && origin ? `translate(${origin.x} ${origin.y})` : undefined; | ||
return ( | ||
<Path | ||
className={className} | ||
role={role || "presentation"} | ||
shapeRendering={shapeRendering || "auto"} | ||
d={path} | ||
transform={transform} | ||
{...nativeStyle} | ||
{...events} | ||
/> | ||
); | ||
} | ||
static defaultProps = Object.assign({}, Bar.defaultProps, { | ||
pathComponent: <Path/> | ||
}); | ||
} |
import React from "react"; | ||
import { Rect } from "react-native-svg"; | ||
import { NativeHelpers } from "../../index"; | ||
import { Rect } from "../../index"; | ||
import { Border } from "victory-core/es"; | ||
export default class extends Border { | ||
// Overrides method in victory-core | ||
renderBorder(props, style, events) { | ||
const nativeStyle = NativeHelpers.getStyle(style); | ||
const { role, shapeRendering, className } = this.props; | ||
return ( | ||
<Rect | ||
{...props} | ||
className={className} | ||
role={role || "presentation"} | ||
shapeRendering={shapeRendering || "auto"} | ||
vectorEffect="non-scaling-stroke" | ||
{...nativeStyle} | ||
{...events} | ||
/> | ||
); | ||
} | ||
static defaultProps = Object.assign({}, Border.defaultProps, { | ||
rectComponent: <Rect/> | ||
}); | ||
} |
import React from "react"; | ||
import { Line, Rect, G } from "react-native-svg"; | ||
import { NativeHelpers } from "../../index"; | ||
import { Line, Rect } from "../../index"; | ||
import { G } from "react-native-svg"; | ||
import { Candle } from "victory-core/es"; | ||
export default class extends Candle { | ||
static defaultProps = { | ||
groupComponent: <G/> | ||
}; | ||
// Overrides method in victory-core | ||
renderWick(props) { | ||
const nativeStyle = NativeHelpers.getStyle(props.style); | ||
return <Line {...props} {...nativeStyle}/>; | ||
} | ||
// Overrides method in victory-core | ||
renderCandle(props) { | ||
const nativeStyle = NativeHelpers.getStyle(props.style); | ||
return <Rect {...props} {...nativeStyle}/>; | ||
} | ||
static defaultProps = Object.assign({}, Candle.defaultProps, { | ||
groupComponent: <G/>, | ||
lineComponent: <Line/>, | ||
rectComponent: <Rect/> | ||
}); | ||
} |
import React from "react"; | ||
import { ClipPath as Clip, Rect, Defs, Circle } from "react-native-svg"; | ||
import { ClipPath } from "victory-core/es"; | ||
import PropTypes from "prop-types"; | ||
import { Defs, ClipPath } from "react-native-svg"; | ||
export default class extends ClipPath { | ||
// Overrides method in victory-core | ||
renderClipPath(props, id) { | ||
return ( | ||
<Defs> | ||
<Clip id={`${id}`}> | ||
<Rect {...props}/> | ||
</Clip> | ||
</Defs> | ||
); | ||
} | ||
export default class VClipPath extends React.Component { | ||
static propTypes = { | ||
children: PropTypes.oneOfType([ | ||
PropTypes.arrayOf(PropTypes.node), | ||
PropTypes.node | ||
]), | ||
clipId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]) | ||
}; | ||
// Overrides method in victory-core | ||
renderPolarClipPath(props, id) { | ||
render() { | ||
const { children, clipId } = this.props; | ||
return ( | ||
<Defs> | ||
<Clip id={id}> | ||
<Circle {...props}/> | ||
</Clip> | ||
<ClipPath id={clipId}> | ||
{children} | ||
</ClipPath> | ||
</Defs> | ||
@@ -25,0 +22,0 @@ ); |
import React from "react"; | ||
import { Path, G } from "react-native-svg"; | ||
import { NativeHelpers } from "../../index"; | ||
import { Path } from "../../index"; | ||
import { Curve } from "victory-core/es"; | ||
export default class extends Curve { | ||
static defaultProps = { | ||
groupComponent: <G/> | ||
}; | ||
// Overrides method in victory-core | ||
renderLine(path, style, events) { | ||
const { role, shapeRendering, className, polar, origin } = this.props; | ||
const nativeStyle = NativeHelpers.getStyle(style); | ||
const transform = polar && origin ? `translate(${origin.x} ${origin.y})` : undefined; | ||
return ( | ||
<Path | ||
key={"curve"} | ||
shapeRendering={shapeRendering || "auto"} | ||
role={role || "presentation"} | ||
d={path} | ||
className={className} | ||
transform={transform} | ||
{...nativeStyle} | ||
{...events} | ||
/> | ||
); | ||
} | ||
static defaultProps = Object.assign({}, Curve.defaultProps, { | ||
pathComponent: <Path/> | ||
}); | ||
} |
import React from "react"; | ||
import { G, Line } from "react-native-svg"; | ||
import { NativeHelpers } from "../../index"; | ||
import { Line } from "../../index"; | ||
import { G } from "react-native-svg"; | ||
import { ErrorBar } from "victory-core/es"; | ||
export default class extends ErrorBar { | ||
static defaultProps = { | ||
borderWidth: 10, | ||
groupComponent: <G/> | ||
} | ||
// Overrides method in victory-core | ||
renderLine(props, style, events) { | ||
const nativeStyle = NativeHelpers.getStyle(style); | ||
return <Line {...props} {...nativeStyle} {...events}/>; | ||
} | ||
static defaultProps = Object.assign({}, ErrorBar.defaultProps, { | ||
groupComponent: <G/>, | ||
lineComponent: <Line/> | ||
}); | ||
} |
import React from "react"; | ||
import { Path } from "react-native-svg"; | ||
import { Path } from "../../index"; | ||
import { Flyout } from "victory-core/es"; | ||
import { NativeHelpers } from "../../index"; | ||
export default class extends Flyout { | ||
// Overrides method in victory-core | ||
renderFlyout(path, style, events) { | ||
const nativeStyle = NativeHelpers.getStyle(style); | ||
const { role, shapeRendering, className } = this.props; | ||
return ( | ||
<Path | ||
className={className} | ||
shapeRendering={shapeRendering || "auto"} | ||
role={role || "presentation"} | ||
d={path} | ||
{...nativeStyle} | ||
{...events} | ||
/> | ||
); | ||
} | ||
static defaultProps = Object.assign({}, Flyout.defaultProps, { | ||
pathComponent: <Path/> | ||
}); | ||
} |
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import { Collection } from "victory-core"; | ||
import { Line } from "react-native-svg"; | ||
import { NativeHelpers } from "../../index"; | ||
import { Line as VLine } from "victory-core/es"; | ||
export default class extends VLine { | ||
// Overrides method in victory-core | ||
renderAxisLine(props, style, events) { | ||
const nativeStyle = NativeHelpers.getStyle(style); | ||
const { role, shapeRendering, className } = this.props; | ||
export default class VLine extends React.Component { | ||
static propTypes = { | ||
className: PropTypes.string, | ||
clipPath: PropTypes.string, | ||
events: PropTypes.object, | ||
role: PropTypes.string, | ||
shapeRendering: PropTypes.string, | ||
style: PropTypes.object, | ||
transform: PropTypes.string, | ||
x1: PropTypes.number, | ||
x2: PropTypes.number, | ||
y1: PropTypes.number, | ||
y2: PropTypes.number | ||
}; | ||
shouldComponentUpdate(nextProps) { | ||
const { className, clipPath, x1, x2, y1, y2, style, transform } = this.props; | ||
if (!Collection.allSetsEqual([ | ||
[className, nextProps.className], | ||
[clipPath, nextProps.clipPath], | ||
[x1, nextProps.x1], | ||
[x2, nextProps.x2], | ||
[y1, nextProps.y1], | ||
[y2, nextProps.y2], | ||
[transform, nextProps.transform], | ||
[style, nextProps.style] | ||
])) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
render() { | ||
const { | ||
x1, x2, y1, y2, events, className, clipPath, transform, shapeRendering, role | ||
} = this.props; | ||
const style = NativeHelpers.getStyle(this.props.style); | ||
return ( | ||
<Line | ||
x1={x1} x2={x2} y1={y1} y2={y2} | ||
className={className} | ||
clipPath={clipPath} | ||
transform={transform} | ||
role={role || "presentation"} | ||
shapeRendering={shapeRendering || "auto"} | ||
vectorEffect="non-scaling-stroke" | ||
{...props} | ||
{...nativeStyle} | ||
{...style} | ||
{...events} | ||
@@ -20,0 +55,0 @@ /> |
import React from "react"; | ||
import { Path } from "react-native-svg"; | ||
import { NativeHelpers } from "../../index"; | ||
import { Path } from "../../index"; | ||
import { Point } from "victory-core/es"; | ||
export default class extends Point { | ||
// Overrides method in victory-core | ||
renderPoint(path, style, events) { | ||
const nativeStyle = NativeHelpers.getStyle(style); | ||
const { role, shapeRendering, className } = this.props; | ||
return ( | ||
<Path | ||
className={className} | ||
role={role || "presentation"} | ||
shapeRendering={shapeRendering || "auto"} | ||
d={path} | ||
{...nativeStyle} | ||
{...events} | ||
/> | ||
); | ||
} | ||
static defaultProps = Object.assign({}, Point.defaultProps, { | ||
pathComponent: <Path/> | ||
}); | ||
} |
import React from "react"; | ||
import { Path } from "react-native-svg"; | ||
import { Path } from "../../index"; | ||
import { Slice } from "victory-core/es"; | ||
import { NativeHelpers } from "../../index"; | ||
export default class extends Slice { | ||
// Overrides method in victory-core | ||
renderSlice(path, style, events) { | ||
const { role, shapeRendering, className, origin } = this.props; | ||
const nativeStyle = NativeHelpers.getStyle(style); | ||
const transform = origin ? `translate(${origin.x} ${origin.y})` : undefined; | ||
return ( | ||
<Path | ||
className={className} | ||
role={role || "presentation"} | ||
shapeRendering={shapeRendering || "auto"} | ||
d={path} | ||
transform={transform} | ||
{...nativeStyle} | ||
{...events} | ||
/> | ||
); | ||
} | ||
static defaultProps = Object.assign({}, Slice.defaultProps, { | ||
pathComponent: <Path/> | ||
}); | ||
} |
import React from "react"; | ||
import { Path, G, ClipPath, Defs } from "react-native-svg"; | ||
import { Path, ClipPath, Circle } from "../../index"; | ||
import { G } from "react-native-svg"; | ||
import { Voronoi } from "victory-core/es"; | ||
import { NativeHelpers } from "../../index"; | ||
export default class extends Voronoi { | ||
// Overrides method in victory-core | ||
renderPoint(paths, style, events) { | ||
const clipId = `clipPath-${Math.random()}`; | ||
const nativeStyle = NativeHelpers.getStyle(style); | ||
const { className, role, shapeRendering } = this.props; | ||
return paths.circle ? | ||
( | ||
<G> | ||
<Defs> | ||
<ClipPath id={clipId}> | ||
<Path d={paths.voronoi}/> | ||
</ClipPath> | ||
</Defs> | ||
<Path | ||
d={paths.circle} | ||
className={className} | ||
role={role || "presentation"} | ||
shapeRendering={shapeRendering || "auto"} | ||
clipPath={`url(#${clipId})`} | ||
{...nativeStyle} | ||
{...events} | ||
/> | ||
</G> | ||
) : ( | ||
<Path | ||
className={className} | ||
role={role || "presentation"} | ||
shapeRendering={shapeRendering || "auto"} | ||
d={paths.voronoi} | ||
{...nativeStyle} | ||
{...events} | ||
/> | ||
); | ||
} | ||
static defaultProps = Object.assign({}, Voronoi.defaultProps, { | ||
groupComponent: <G/>, | ||
pathComponent: <Path/>, | ||
clipPathComponent: <ClipPath/>, | ||
circleComponent: <Circle/> | ||
}); | ||
} |
@@ -11,4 +11,3 @@ import React from "react"; | ||
export default class extends VictoryScatter { | ||
static defaultProps = { | ||
...VictoryScatter.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryScatter.defaultProps, { | ||
dataComponent: <Point/>, | ||
@@ -19,3 +18,3 @@ labelComponent: <VictoryLabel/>, | ||
width: Dimensions.get("window").width | ||
}; | ||
}); | ||
} |
@@ -16,4 +16,3 @@ import React from "react"; | ||
export const selectionContainerMixin = (base) => class VictoryNativeSelectionContainer extends base { // eslint-disable-line max-len | ||
static defaultProps = { | ||
...VictoryContainer.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryContainer.defaultProps, { | ||
selectionStyle: { | ||
@@ -26,3 +25,3 @@ stroke: "transparent", | ||
selectionComponent: <DefaultSelectionComponent /> | ||
}; | ||
}); | ||
@@ -37,10 +36,3 @@ static defaultEvents = [{ | ||
onTouchMove: (evt, targetProps) => { | ||
const mutations = SelectionHelpers.onMouseMove(evt, targetProps); | ||
if (mutations.id !== this.touchMoveMutationId) { // eslint-disable-line | ||
this.touchMoveMutationId = mutations.id; // eslint-disable-line | ||
return mutations.mutations; | ||
} | ||
return []; | ||
return SelectionHelpers.onMouseMove(evt, targetProps); | ||
}, | ||
@@ -47,0 +39,0 @@ onTouchEnd: (evt, targetProps) => { |
@@ -9,8 +9,7 @@ import React from "react"; | ||
export default class extends VictoryStack { | ||
static defaultProps = { | ||
...VictoryStack.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryStack.defaultProps, { | ||
containerComponent: <VictoryContainer/>, | ||
groupComponent: <G/>, | ||
width: Dimensions.get("window").width | ||
}; | ||
}); | ||
} |
@@ -9,8 +9,7 @@ import React from "react"; | ||
export default class extends VictoryTooltip { | ||
static defaultProps = { | ||
...VictoryTooltip.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryTooltip.defaultProps, { | ||
labelComponent: <VictoryLabel/>, | ||
flyoutComponent: <Flyout/>, | ||
groupComponent: <G/> | ||
}; | ||
}); | ||
@@ -17,0 +16,0 @@ static defaultEvents = [{ |
@@ -5,20 +5,8 @@ import React from "react"; | ||
const onTouchStartOrMove = (evt, targetProps) => { | ||
const mutations = VoronoiHelpers.onMouseMove(evt, targetProps); | ||
if (mutations.id !== this.mutationId) { // eslint-disable-line | ||
this.mutationId = mutations.id; // eslint-disable-line | ||
return mutations.mutations; | ||
} | ||
return []; | ||
}; | ||
export const voronoiContainerMixin = (base) => class VictoryNativeVoronoiContainer extends base { | ||
static defaultProps = { | ||
...VictoryContainer.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryContainer.defaultProps, { | ||
standalone: true, | ||
labelComponent: <VictoryTooltip/>, | ||
voronoiPadding: 5 | ||
}; | ||
}); | ||
@@ -28,4 +16,8 @@ static defaultEvents = [{ | ||
eventHandlers: { | ||
onTouchStart: onTouchStartOrMove, | ||
onTouchMove: onTouchStartOrMove, | ||
onTouchStart: (evt, targetProps) => { | ||
return VoronoiHelpers.onMouseMove(evt, targetProps); | ||
}, | ||
onTouchMove: (evt, targetProps) => { | ||
return VoronoiHelpers.onMouseMove(evt, targetProps); | ||
}, | ||
onTouchEnd: (evt, targetProps) => { | ||
@@ -32,0 +24,0 @@ return VoronoiHelpers.onMouseLeave(evt, targetProps); |
@@ -11,4 +11,3 @@ import React from "react"; | ||
export default class extends VictoryVoronoi { | ||
static defaultProps = { | ||
...VictoryVoronoi.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryVoronoi.defaultProps, { | ||
dataComponent: <Voronoi/>, | ||
@@ -19,3 +18,3 @@ labelComponent: <VictoryLabel/>, | ||
width: Dimensions.get("window").width | ||
}; | ||
}); | ||
} |
@@ -5,4 +5,3 @@ import React from "react"; | ||
export const zoomContainerMixin = (base) => class VictoryNativeZoomContainer extends base { | ||
static defaultProps = { | ||
...VictoryContainer.defaultProps, | ||
static defaultProps = Object.assign({}, VictoryContainer.defaultProps, { | ||
clipContainerComponent: <VictoryClipContainer/>, | ||
@@ -12,3 +11,3 @@ allowZoom: true, | ||
zoomActive: false | ||
}; | ||
}); | ||
@@ -15,0 +14,0 @@ static defaultEvents = [{ |
@@ -10,6 +10,12 @@ import createContainer from "./helpers/create-container"; | ||
export { default as Circle } from "./components/victory-primitives/line"; | ||
export { default as Line } from "./components/victory-primitives/line"; | ||
export { default as Path } from "./components/victory-primitives/path"; | ||
export { default as Rect } from "./components/victory-primitives/rect"; | ||
export { default as Text } from "./components/victory-primitives/text"; | ||
export { default as TSpan } from "./components/victory-primitives/tspan"; | ||
export { default as Arc } from "./components/victory-primitives/arc"; | ||
export { default as Area } from "./components/victory-primitives/area"; | ||
export { default as Bar } from "./components/victory-primitives/bar"; | ||
export { default as Border } from "./components/victory-primitives/border"; | ||
export { default as Border, default as Box } from "./components/victory-primitives/border"; | ||
export { default as Candle } from "./components/victory-primitives/candle"; | ||
@@ -19,3 +25,3 @@ export { default as ClipPath } from "./components/victory-primitives/clip-path"; | ||
export { default as ErrorBar } from "./components/victory-primitives/error-bar"; | ||
export { default as Line } from "./components/victory-primitives/line"; | ||
export { default as Axis, default as Grid } from "./components/victory-primitives/line"; | ||
export { default as Point } from "./components/victory-primitives/point"; | ||
@@ -22,0 +28,0 @@ export { default as Slice } from "./components/victory-primitives/slice"; |
{ | ||
"name": "victory-native", | ||
"version": "0.16.6", | ||
"version": "0.17.0", | ||
"description": "Shared libraries and components for Victory", | ||
@@ -46,3 +46,3 @@ "main": "lib/index.js", | ||
"react-native": "~0.51.0", | ||
"react-native-svg": "6.0.1-rc.1", | ||
"react-native-svg": "^6.1.0", | ||
"react-native-svg-mock": "^2.0.0", | ||
@@ -54,6 +54,6 @@ "react-test-renderer": "^16.0.0" | ||
"prop-types": "^15.5.10", | ||
"victory-chart": "^24.3.0", | ||
"victory-core": "^20.2.0", | ||
"victory-pie": "^13.0.0" | ||
"victory-chart": "^25.0.2", | ||
"victory-core": "^21.0.2", | ||
"victory-pie": "^14.0.0" | ||
} | ||
} |
55863
52
1228
+ Addedreact-fast-compare@1.0.0(transitive)
+ Addedvictory-chart@25.2.5(transitive)
+ Addedvictory-core@21.1.13(transitive)
+ Addedvictory-pie@14.0.2(transitive)
- Removedvictory-chart@24.6.1(transitive)
- Removedvictory-core@20.6.0(transitive)
- Removedvictory-pie@13.3.1(transitive)
Updatedvictory-chart@^25.0.2
Updatedvictory-core@^21.0.2
Updatedvictory-pie@^14.0.0