From b8d9545e5e9439f826047e7061171e1a8fe54477 Mon Sep 17 00:00:00 2001 From: Wadah Esam Date: Tue, 9 Jan 2024 07:42:01 +0300 Subject: [PATCH] fix: line not appearing for android on mount --- src/SvgPath.tsx | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/SvgPath.tsx b/src/SvgPath.tsx index aa32563..4ce80a1 100644 --- a/src/SvgPath.tsx +++ b/src/SvgPath.tsx @@ -148,7 +148,21 @@ const LineComponent = ({ return ACTIVE_POINT_CONFIG.color; }, [line?.activePointConfig?.color, line?.lineColor, isLineColorGradient]); - const [localPath, setLocalPath] = React.useState(); + const [localPath, setLocalPath] = React.useState( + createNewPath({ + data: line?.data || [], + allData, + endSpacing: extraConfig.endSpacing || 20, + svgHeight, + svgWidth, + isFilled: line.fillColor !== undefined, + alwaysStartYAxisFromZero: extraConfig.alwaysStartYAxisFromZero || false, + curve: line.curve, + calculateChartYAxisMinMax: + extraConfig.calculateChartYAxisMinMax || undefined, + }) + ); + const forceRerender = useForceReRender(); // forcing a re-render after x ms to fix sharedValues not causing a rerender. @@ -234,10 +248,6 @@ const LineComponent = ({ }); }, [line.lineColor, line.trailingOpacity]); - if (localPath === undefined) { - return null; - } - return ( <> @@ -274,8 +284,8 @@ const LineComponent = ({ {line.endPointConfig && (