Skip to content

Commit edca15a

Browse files
authored
Fix/on layout view (#621)
1 parent a8e0019 commit edca15a

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

.changeset/tiny-badgers-bathe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"victory-native": patch
3+
---
4+
5+
use `View` for cartestian chart `onLayout`

lib/src/cartesian/CartesianChart.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from "react";
2-
import { type LayoutChangeEvent } from "react-native";
2+
import { View, type LayoutChangeEvent } from "react-native";
33
import { Canvas, Group, type CanvasRef } from "@shopify/react-native-skia";
44
import { useSharedValue } from "react-native-reanimated";
55
import {
@@ -724,23 +724,23 @@ function CartesianChartContent<
724724
}
725725

726726
return (
727-
<GestureHandlerRootView
728-
style={{ flex: 1, overflow: "hidden" }}
729-
onLayout={onLayout}
730-
>
731-
{body}
732-
<GestureHandler
733-
config={gestureHandlerConfig}
734-
gesture={composed}
735-
transformState={transformState}
736-
dimensions={{
737-
x: Math.min(xScale.range()[0]!, 0),
738-
y: Math.min(primaryYScale.range()[0]!, 0),
739-
width: xScale.range()[1]! - Math.min(xScale.range()[0]!, 0),
740-
height:
741-
primaryYScale.range()[1]! - Math.min(primaryYScale.range()[0]!, 0),
742-
}}
743-
/>
727+
<GestureHandlerRootView>
728+
<View style={{ flex: 1, overflow: "hidden" }} onLayout={onLayout}>
729+
{body}
730+
<GestureHandler
731+
config={gestureHandlerConfig}
732+
gesture={composed}
733+
transformState={transformState}
734+
dimensions={{
735+
x: Math.min(xScale.range()[0]!, 0),
736+
y: Math.min(primaryYScale.range()[0]!, 0),
737+
width: xScale.range()[1]! - Math.min(xScale.range()[0]!, 0),
738+
height:
739+
primaryYScale.range()[1]! -
740+
Math.min(primaryYScale.range()[0]!, 0),
741+
}}
742+
/>
743+
</View>
744744
</GestureHandlerRootView>
745745
);
746746
}

0 commit comments

Comments
 (0)